         return Splinter(separator: rsep, node: node)
     }
 
+    func swapContents(other: Node) {
+        swap(&self.elements, &other.elements)
+        swap(&self.children, &other.children)
+        swap(&self.count, &other.count)
+        swap(&self._depth, &other._depth)
+        swap(&self._order, &other._order)
+    }
+
     /// Create and return a new b-tree consisting of elements of `left`,`separator` and the elements of `right`,
     /// in this order.
     ///

    /// - 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 depthDelta = left.depth - right.depth
        let append = depthDelta >= 0
        

        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)
