anchor.diff:      % Get the children of those nodes, that intersect the input MBR,
       % so that they can be repacked for better query performance
       PosToRepack = [Children || {_Mbr, _Pos, Children} <- NotDisjoint],
  -    %?debugVal(PosToRepack),
  +    ?debugVal(PosToRepack),
   
       % And reduce the disjoint nodes to MBR and position in file only
       DisjointMbrAndPos = [{Mbr, Pos} || {Mbr, Pos, _Children} <- Disjoint],
  +?debugVal(DisjointMbrAndPos),
       % Get the actual nodes that should be repacked
  -    {NodesToRepack, OmtMbrAndPos2} = case lists:append(PosToRepack) of
  +    %{NodesToRepack, OmtMbrAndPos2, DisjointMbrAndPos2} = case lists:append(PosToRepack) of
  +    %PosToRepack2 when is_tuple(hd(PosToRepack2)) ->
  +    PosToRepack2 = lists:append(PosToRepack),
  +    {NodesToRepack, OmtMbrAndPos2, DisjointMbrAndPos2} = case PosToRepack2 of
  +    [] ->
  +?debugMsg("empty list"),
  +        OmtLeafsList = lists:map(fun({_, OmtLeafsPos}) ->
  +            {ok, {Mbr, _, OmtLeafs}} = couch_file:pread_term(Fd, OmtLeafsPos),
  +            {Mbr, OmtLeafs}
  +        end, OmtMbrAndPos),
  +?debugVal(OmtLeafsList),
  +%        OmtLeafsMbrAndLeaf = lists:append(OmtLeafsList),
  +%?debugVal(OmtLeafsMbrAndLeaf),
  +        %{PosToRepack2, OmtMbrAndPos, DisjointMbrAndPos};
  +%        {PosToRepack2, OmtLeafsMbrAndLeaf, DisjointMbrAndPos};
  +        {PosToRepack2, OmtLeafsList, DisjointMbrAndPos};
       PosToRepack2 when is_tuple(hd(PosToRepack2)) ->
  +?debugMsg("reached leaf nodes"),
           % Reached leaf nodes
           % OMT tree nodes are on the same level as those nodes =>
           % OMT tree nodes are leaf nodes => load those nodes
  
positive.code:     % a normal one (line Ang/Tan) is that it can split several levels at
      % one time (and not only split into two partitions)
  %?LOG_INFO("Here's the bug: ~p~n~p", [ToRepackMbrAndPos, OmtMbrAndPos2]),
      {NewNodes, NewNodesHeight} = omt_load(
          %ToRepackMbrAndPos ++ OmtMbrAndPos, ?MAX_FILLED),
          ToRepackMbrAndPos ++ OmtMbrAndPos2, ?MAX_FILLED),
  %    ToRepackMbrAndPos2 = if
  %        is_list(ToRepackMbrAndPos) -> ToRepackMbrAndPos;
  %        true -> [ToRepackMbrAndPos]
  
negative.code:     % sinlgle position in file (but the omt_load returns a root node with
      % multiple children).
      %HeightDiff = InsertHeight - (OmtHeight + 1),
      %HeightDiff = InsertHeight - OmtHeight,
      HeightDiff = InsertHeight - (OmtHeight - 1),
      ?debugVal(HeightDiff),
      NewChildrenPos2 = if
      % Input tree can be inserted as-is into the target tree
      HeightDiff == 0 ->
      ?debugMsg("insert as is"),
          {OmtTree, OmtHeight} = omt_load(New, ?MAX_FILLED),
          ?debugVal(OmtHeight),
          %?debugVal(OmtTree),
  
  %        OmtRootNodes = [{Mbr, #node{type=inner}, Pos} || {Mbr, Pos} <-
  