             elementIndex += elementCount
         }
         return elementIndex
-    }
-    
-    private func leafNodeIndexToElementIndex(_ nodeIndex: Int) -> Int {
-        return BVH.leafNodeIndexToElementIndex(nodeIndex, elementCount: self.elementCount, lastRowIndex: self.lastRowIndex)
     }
     
     private static func isLeaf(_ index: Int, elementCount: Int) -> Bool {

    }
    
    func visit(callback: (BVHNode, Int) -> Bool) {
        func visit(index: Int, depth: Int, callback: (BVHNode, Int) -> Bool) {
            let leaf = BVH.isLeaf(index, elementCount: elementCount)
            let nodeType: BVHNode.NodeType = leaf ? .leaf(elementIndex: self.leafNodeIndexToElementIndex(index)) : .internal
            let node = BVHNode(boundingBox: self.boundingBoxes[index], type: nodeType)
            guard callback(node, depth) == true else {
                return
            }

            let leaf1: Bool = BVH.isLeaf(index1, elementCount: elementCount1)
            let leaf2: Bool = BVH.isLeaf(index2, elementCount: elementCount2)
            if leaf1, leaf2 {
                let elementIndex1 = BVH.leafNodeIndexToElementIndex(index1, elementCount: elementCount1, lastRowIndex: lastRowIndex1)
                let elementIndex2 = BVH.leafNodeIndexToElementIndex(index2, elementCount: elementCount2, lastRowIndex: lastRowIndex2)
                callback(elementIndex1, elementIndex2)
            }
            else if leaf1 {
