 		int vtxOffset,
 		std::vector<aten::ThreadedBvhNode>* threadedBvhNodes)
 	{
-		uint32_t numOfElems = (uint32_t)triangles.num();
+		uint32_t numberOfTris = (uint32_t)triangles.num();
 
 		// Compute morton code.
 		{
-			uint32_t numberOfTris = triangles.num();
-
 			dim3 block(256, 1, 1);
 			dim3 grid((numberOfTris + block.x - 1) / block.x, 1, 1);
 


		// Compute bouding box.
		{
			uint32_t numberOfTris = triangles.num();

			dim3 block(128, 1, 1);
			dim3 grid((numberOfTris + block.x - 1) / block.x, 1, 1);


// https://github.com/leonardo-domingues/atrbvh
// http://research.nvidia.com/sites/default/files/publications/karras2012hpg_paper.pdf

__forceinline__ __device__ __host__ int computeLongestCommonPrefix(
	const uint32_t* sortedKeys,
	uint32_t numOfElems,
	int index1, int index2,
