         else
           relativeStart = position.traversalFrom(childStart)
           if splitNodes = child.splice(relativeStart, oldExtent, newExtent, exclusiveIds, precedingIds)
-            @children.splice(i - 1, 1, splitNodes...)
+            @children.splice(i, 1, splitNodes...)
           remainderToDelete = spliceOldEnd.traversalFrom(childEnd)
           childEnd = childStart.traverse(child.extent)
 
-      if @children[i - 2]?.shouldMergeWith(child)
-        @children.splice(i - 2, 2, @children[i - 2].merge(child))
-        i--
-
+      i++ unless @mergeChildrenIfNeeded(i - 1)
       precedingIds = child.ids
 
-    if @children.length > BRANCHING_THRESHOLD
-      splitIndex = Math.ceil(@children.length / BRANCHING_THRESHOLD)
-      [new Node(@children.slice(0, splitIndex)), new Node(@children.slice(splitIndex))]
+    @splitIfNeeded()
 
   getStart: (id) ->
     return unless @ids.has(id)

    if children[joinIndex].shouldMergeWith(children[joinIndex + 1])
      children.splice(joinIndex, 2, children[joinIndex].merge(children[joinIndex + 1]))
    new Node(children)

  toString: (indentLevel=0) ->
    indent = ""

        i += newChildren.length - 1
      break if rangeIsEmpty

    if newNodes = @splitIfNeeded()
      newNodes
    else
      addSet(@ids, ids)
      return
