         cudaFuncGetAttributes(&funcAttr, SpherePartitioningByConesKernel);
         blocksize = funcAttr.maxThreadsPerBlock > 256 ? 256 : funcAttr.maxThreadsPerBlock;
         blocks = (nActiveSpheres / blocksize) + 1;
-        // TODO don't offset sphereIndices and other arrays? And fix the error
         SpherePartitioningByConesKernel<<<blocks, blocksize>>>
             (RawPointer(sphereIndices),
              RawPointer(sphereIndexPartition),

        // cout << "\n ** Before Leaf removal **\n" << ToString(true) << endl;

        // *** Remove leafs ***
        CreateLeafNodes();        

        // cout << "\n ** After Leaf removal **\n" << ToString(true) << endl;
    }
    CHECK_FOR_CUDA_ERROR();

        : bound(bound), boundInvSize(bound.InvertedSize()) {}

    __host__ __device__
    inline MortonCode operator()(const thrust::tuple<float4, float4> ray) const {

        float3 origin = make_float3(thrust::get<0>(ray));
        const float3 direction = make_float3(thrust::get<1>(ray));
        return (*this)(origin, direction);
    }
    
    __host__ __device__
    inline MortonCode operator()(float3 origin, const float3 direction) const {
        
        float tHit;
        if (!bound.ClosestIntersection(origin, direction, tHit)) 
