anchor.diff:      length(ChildrenPos) =< ?MAX_FILLED ->
           NewNode = {MergedMbr, ParentMeta, ChildrenPos},
           {ok, Pos} = couch_file:append_term(Fd, NewNode),
  +?debugVal(Pos),
           {ok, MergedMbr, Pos, 0};
       true ->
  +?debugVal(length(ChildrenPos)),
           %io:format("We need to split (leaf node)~n~p~n", [LeafNode]),
           Children = load_nodes(Fd, ChildrenPos),
  -        % NOTE vmx: for vtree:split/1 the nodes need to have a special format
  -        %     a tuple with their MBR, Meta and *their* position in the file
  -        %     (as opposed to the position of their children)
  +
  +        % Transform the the nodes, so that we don't need to write them again.
  +        % They are now a tuple with their MBR, Meta and *their* position
  +        % in the file (as opposed to the position of their children)
           Children2 = [{Mbr, Meta, Pos} || {{Mbr, Meta, _}, Pos} <-
                   lists:zip(Children, ChildrenPos)],
  -        {SplittedMbr, {Node1Mbr, _, _}=Node1, {Node2Mbr, _, _}=Node2}
  -                = vtree:split_node({MergedMbr, #node{type=inner}, Children2}),
  -%                = vtree:split_node({MergedMbr, #node{type=inner}, ChildrenPos}),
  +
  +        % The maximum number of nodes can be 2*MAX_FILLED, therefore we can't
  +        % use the Ang/Tan split algorithm, but use the OMT algorithm to split
  +        % the nodes into two partitions.
  +        {[Part1, Part2], _OmtHeight} = omt_load(Children2, ?MAX_FILLED),
  +
  +        Mbr1 = vtree:calc_nodes_mbr(Part1),
  +        Mbr2 = vtree:calc_nodes_mbr(Part2),
  +        % Get the original position in file of the nodes
  +        Part1Pos = [Pos || {_Mbr, _Meta, Pos} <- Part1],
  +        Part2Pos = [Pos || {_Mbr, _Meta, Pos} <- Part2],
  +        Node1 =  {Mbr1, #node{type=inner}, Part1Pos},
  +        Node2 =  {Mbr2, #node{type=inner}, Part2Pos},
           {ok, Pos1} = couch_file:append_term(Fd, Node1),
           {ok, Pos2} = couch_file:append_term(Fd, Node2),
  -        {splitted, SplittedMbr, {Node1Mbr, Pos1}, {Node2Mbr, Pos2}, 0}
  +
  +        {splitted, MergedMbr, {Mbr1, Pos1}, {Mbr2, Pos2}, 0}
       end;
   insert_subtree(Fd, RootPos, Subtree, Level, Depth) ->
       %{SubtreeMbr, SubtreePos} = Subtree,
  
positive.code:     LeastRestPos = [Pos || {Mbr, Pos} <- LeastRest],
      case insert_subtree(Fd, LeastPos, Subtree, Level, Depth+1) of
      {ok, NewMbr, NewPos, Inc} ->
          MergedMbr = vtree:merge_mbr(ParentMbr, NewMbr),
          NewNode = {MergedMbr, #node{type=inner}, [NewPos|LeastRestPos]},
          {ok, Pos} = couch_file:append_term(Fd, NewNode),
          {ok, NewMbr, Pos, Inc};
      {splitted, ChildMbr, {Child1Mbr, ChildPos1}, {Child2Mbr, ChildPos2}, Inc} ->
          MergedMbr = vtree:merge_mbr(ParentMbr, ChildMbr),
  
negative.code:         end;
      % insert new tree into target tree
      Diff when Diff > 0 ->
      ?debugMsg("target tree higher"),
          {ok, _, SubPos, Inc} = insert_subtree(Fd, TargetPos, MbrAndPosList, Diff-1),
          {SubPos, TargetHeight+Inc};
      % insert target tree into new tree
      Diff when Diff < 0 ->
      ?debugMsg("target tree smaller"),
          % NOTE vmx: I don't think this case can ever happen
          %case length(MbrAndPosList) of
          %1 ->
  