          ***/
 
         /*** if half of shared memory or more is filled with the the nodes, dump these into slowmem stack ***/
-        while(n_offset >= DIM) 
+        while(n_offset >= WARP_SIZE) 
         {
-          n_offset -= DIM;
+          n_offset -= WARP_SIZE;
           const int offs1 = ACCS<SHIFT>(n_stack1);
           nstack[offs1] = nodesM[n_offset + laneId];   n_stack1++;
-          n_nodes1 += DIM;
+          n_nodes1 += WARP_SIZE;
 
           if((n_stack1 - c_stack0) >= (LMEM_STACK_SIZE << SHIFT))
           {

      int     *MEM_BUF) 
{
  const int blockDim2 = NTHREAD2;
  const int shMemSize = 10 * (1 << blockDim2);
  __shared__ int shmem_pool[shMemSize];

  const int nWarps2 = blockDim2 - WARP_SIZE2;

  int n_direct = 0;


  for (int root_node = node_begend.x; root_node < node_begend.y; root_node += WARP_SIZE) 
  {
    int n_nodes0 = min(node_begend.y - root_node, WARP_SIZE);
    int n_stack0 = 0;
    int n_stack_pre = 0;

