          RawPointer(nextSphereIndexPartition) + leafNodes + nNewLeafs); // next data owners
     CHECK_FOR_CUDA_ERROR();
 
-    /*    
     cudaMemcpy(RawPointer(sphereIndices) + leafSphereIndices,
                RawPointer(nextSphereIndices) + leafSphereIndices,
                sizeof(unsigned int) * nNewLeafIndices, cudaMemcpyDeviceToDevice);

               RawPointer(nextSphereIndexPartition) + leafSphereIndices,
               sizeof(unsigned int) * nNewLeafIndices, cudaMemcpyDeviceToDevice);
    CHECK_FOR_CUDA_ERROR();
    */
    
    thrust::copy(nextSphereIndices.begin() + leafSphereIndices,
                 nextSphereIndices.begin() + leafSphereIndices + nNewLeafIndices,
                 sphereIndices.begin() + leafSphereIndices);
    thrust::copy(nextSphereIndexPartition.begin() + leafSphereIndices,
                 nextSphereIndexPartition.begin() + leafSphereIndices + nNewLeafIndices,
                 sphereIndexPartition.begin() + leafSphereIndices);
    CHECK_FOR_CUDA_ERROR();

    sphereIndices.swap(nextSphereIndices);
    sphereIndexPartition.swap(nextSphereIndexPartition);



#include <iostream>

#include <thrust/remove.h>
#include <thrust/scan.h>
#include <thrust/sort.h>
