     internal var isTooSmall: Bool { return keys.count < minKeys }
     internal var isTooLarge: Bool { return keys.count > maxKeys }
     internal var isBalanced: Bool { return keys.count >= minKeys && keys.count <= maxKeys }
+
+    internal var depth: Int {
+        var depth = 0
+        var node = self
+        while !node.isLeaf {
+            node = node.children[0]
+            depth += 1
+        }
+        return depth
+    }
 }
 
 //MARK: Lookup

    }
}

//MARK: Internal limits and properties

extension BTree {

            self = children[0]
        }
        return payload
    }

    public mutating func removeAt(index: Index) -> (Key, Payload) {
        let key = self[index].0
        return (key, remove(key)!)
    }

    private mutating func removeAndCollapse(key: Key) -> Payload? {
