     /// - Complexity: O(log(left.count + right.count))
     internal static func join(left left: BTreeNode, separator: (Key, Payload), right: BTreeNode) -> BTreeNode {
         precondition(left.order == right.order)
+
+        let order = left.order
         let depthDelta = left.depth - right.depth
         let append = depthDelta >= 0
         

        return Splinter(separator: rsep, node: node)
    }

    /// Create and return a new b-tree consisting of elements of `left`,`separator` and the elements of `right`,
    /// in this order.
    ///

        var path = [stock]
        var node = stock
        let c = scion.count
        for _ in 0 ..< abs(depthDelta) {
            node.count += c + 1
            node = node.makeChildUnique(append ? node.children.count - 1 : 0)
            path.append(node)
        }

        // Graft the scion into the stock by inserting the contents of its root into `node`.
        if !append { node.swapContents(scion) }
        assert(node.depth == scion.depth)
        let slotCount = node.elements.count + 1 + scion.elements.count
        let target = slotCount < order ? slotCount : slotCount / 2
        var splinter = node.shiftSlots(separator: separator, node: scion, target: target)
        if splinter != nil {
            assert(splinter!.node.isBalanced)
            path.removeLast()
            while let s = splinter where !path.isEmpty {
                let node = path.removeLast()
                node.insert(s, inSlot: append ? node.elements.count : 0)
