       minimpty = __shfl(minimpty, jtodo-1);               // Carefully copy the last active thread to all threads, needed outside this loop     
       bestival = __shfl(bestival, jtodo-1);
       ctot = __shfl(ctot, jtodo-1);                
-      clogc = __shfl(clogc, jtodo-1);
+      cacc = __shfl(cacc, jtodo-1);
       lastival = __shfl(ival, jtodo-1);             
       lastimpty = __shfl(impty, jtodo-1);
     }
     if (threadIdx.x == 0) {
       out[i] = bestival;                                  // Output the best split feature value
-      outv[i] = minimpty - T::ffinal(clogc, (float)ctot); // And the impurity gain
+      outv[i] = minimpty - T::ffinal(cacc, (float)ctot);  // And the impurity gain
     }
   }
 }

      jtodo = min(32, jc1 - j);
      for (k = 0; k < jtodo; k++) {                        // Sequentially update counts so that each thread
        if (threadIdx.x == k) {                            // in this warp gets the old and new counts
          ccnt = catcnt[icat + ncats * threadIdx.y];
          cnew = ccnt + cnt;
          catcnt[icat + ncats * threadIdx.y] = cnew;
        }


  int i, j, k, h, jc0, jc1, jtodo;
  long long key;
  int ccnt, ctot, cnew, cnt, ival, icat, lastival, bestival, tmp;
  float update, cacc, impty, minimpty, lastimpty, tmpx;

  for (i = threadIdx.y + blockDim.y * blockIdx.x; i < ntrees*nnodes*nsamps; i += blockDim.y * gridDim.x) {
    // Process a group with fixed itree, inode, and ifeat
