 void FindNewRayPartitions(const uint2* const rayPartitions,
                           const unsigned int rayPartitionCount,
                           const unsigned int* const rayMortonCodes,
-                          uint4* nextRayPartitions) {
+                          uint2* nextRayPartitions) {
     
     const unsigned int id = threadIdx.x + blockDim.x * blockIdx.x;
     


bool MortonDacrtNodes::CreateLeafNodes() {
    
    const size_t activeNodes = spherePartitions.size() - leafNodes;
    const size_t activeSphereIndices = sphereIndices.size() - leafSphereIndices;
    
    cout << "\n --- Create leaf nodes from " << activeNodes << " active nodes and " << activeSphereIndices << " active sphere indices. ---\n" << endl;

    // Locate leaf partitions
    static thrust::device_vector<bool> isLeaf(activeNodes);
    isLeaf.resize(activeNodes);

    // TODO make isLeaf unsigned int and reuse for indices? isLeaf info is
    // stored in an index and it's neighbour.
    thrust::transform(rayPartitions.begin() + leafNodes, rayPartitions.end(),
                      spherePartitions.begin() + leafNodes,
                      isLeaf.begin(), IsNodeLeaf());
    cout << "isLeaf:\n" << isLeaf << endl;    

    static thrust::device_vector<unsigned int> leafNodeIndices(activeNodes+1);
    leafNodeIndices.resize(activeNodes+1);
    leafNodeIndices[0] = 0;
    thrust::transform_inclusive_scan(isLeaf.begin(), isLeaf.end(), leafNodeIndices.begin()+1, 
                                     BoolToInt(), thrust::plus<unsigned int>());

         RawPointer(isLeaf),
         RawPointer(leafSpheresStartIndex),
         RawPointer(leafNodeIndices),
         nActiveSphereIndices, // Currently active data indices
         leafSphereIndices, // number of old data points that have been moved to leafs
         nNewLeafIndices,
         leafNodes, // number of leafs prior to checking for new ones.
