     for (int b = _loop_start; b < B; b += _loop_stride)
     {
         // Go to the regions we're working on
-	float* output_b = &output[b*O];
+	    float* output_b = &output[b*O];
         // Find the sequence item we're working on
-	int t = 0;
+	    int t = 0;
         for (int i=0; i < b; ++i) {
-	    t += lengths[i];
+	        t += lengths[i];
         }
         int length = lengths[b];
         // Each invocation of the kernel sums one batch.
         for (int i=0; i < length; ++i) // Iterate over rows
         {
-	    const float* X_t = &X[(t+i)*O];
+	        const float* X_t = &X[(t+i)*O];
             for (int j=0; j < O; ++j)
             {
               output_b[j] += X_t[j];

        // Find the sequence item we're working on
        const float* X_t = X;
        for (int i=0; i < b; ++i) {
	    X_t += lengths[i] * O;
        }
        // Each invocation of the kernel maxes one sequence.
        // Start by assuming maxes are the first element.

    float two = 2.;
    for (int i = _loop_start; i < N; i += _loop_stride)
    {
        float x = X[i];
        if (x >= threshold)
        {
            dX[i] = dY[i];
        } else
        {
            float exp_x = exp(x);
            float exp_2x = exp(2*x);
            float exp_3x = exp(3*x);

            float omega = (4. * (x+1)) + (4 * exp_2x) + exp_3x + exp_x * (4.*x+6);
            float delta = 2 * exp_x + exp_2x + 2;
            dX[i] = dY[i] * ((exp_x * omega) / pow(delta, two));
        }
    }
}

