anchor.diff:  seedtree_write(Fd, Seedtree, TargetHeight) ->
       Tree = Seedtree#seedtree_root.tree,
   ?debugVal(length(Seedtree#seedtree_root.outliers)),
  +?debugVal(Seedtree#seedtree_root.outliers),
       ?LOG_DEBUG(Tree),
       % InsertHeight is the height the input tree needs to have so that it
       % can be inserted into the target tree
  -    InsertHeight = TargetHeight - Seedtree#seedtree_root.height + 1,
  +    %InsertHeight = TargetHeight - Seedtree#seedtree_root.height + 1,
  +    InsertHeight = TargetHeight - Seedtree#seedtree_root.height,
       ?debugVal(TargetHeight),
       ?debugVal(InsertHeight),
       %seedtree_write(Fd, [Tree], InsertHeight, []).
  
positive.code:             vtree_test:random_node({I,27+I*329,45}),
          Node = {NodeMbr, NodeMeta, {NodeId, NodeData}},
          [Node|Acc]
      end, [], lists:seq(1,12)),
  %    ?debugMsg("------------------------------"),
  %    %LoadedOmt = omt_load([{{10,20,30,40}, foo, bar},
  %    %                     {{11,21,31,41}, foo, bar},
  %    %                     {{12,22,32,42}, foo, bar},
  %    %                     {{13,23,33,43}, foo, bar}],
  %    LoadedOmt = omt_load([{{10,20,30,40}, foo, bar},
  %                         {{13,23,33,43}, foo, bar}],
  %    %LoadedOmt = omt_load([{{10,20,30,40}, foo, bar},
  %    %                     {{11,21,31,41}, foo, bar},
  %    %                     {{12,22,32,42}, foo, bar},
  %    %                     {{13,23,33,43}, foo, bar},
  %    %                     {{14,24,34,44}, foo, bar}],
  %    %LoadedOmt = omt_load(Nodes1,
  %            ?MAX_FILLED),
  %    {ok, WrittenOmt} = omt_write_tree(Fd, LoadedOmt),
  %    ?debugVal(WrittenOmt),
  %    ?debugMsg("------------------------------"),
      
  %    % Test "Case 1: input R-tree fits in the target node" (chapter 6.1)
  %    % Test 1: input tree fits in
  %    % NOTE vmx: seedtree's maximum height should/must be height of the
  %    %    targetree - 2
  %    Seedtree1 = seedtree_init(Fd, RootPos, 1),
  %    ?debugVal(Seedtree1),
  %    Seedtree2 = seedtree_insert_list(Seedtree1, Nodes1),
  %    {ok, ResultPos1} = seedtree_write(Fd, Seedtree2, TargetTreeHeight),
  %    ?debugVal(ResultPos1),
  %    {ok, Lookup1} = vtree:lookup(Fd, ResultPos1, {0,0,1001,1001}),
  %    ?assertEqual(37, length(Lookup1)),
  
  %    % Test 2: input tree produces splits (seedtree height=2)
  %    TargetTreeNodeNum2 = 64,
  %    TargetTreeHeight2 = log_n_ceil(?MAX_FILLED, TargetTreeNodeNum2),
  %    {Nodes2, Fd2, RootPos2} = create_random_nodes_and_packed_tree(
  %        12, TargetTreeNodeNum2, ?MAX_FILLED),
  %
  %    Seedtree2_1 = seedtree_init(Fd2, RootPos2, 1),
  %    ?debugVal(Seedtree2_1),
  %    Seedtree2_2 = seedtree_insert_list(Seedtree2_1, Nodes2),
  %    {ok, ResultPos2} = seedtree_write(Fd2, Seedtree2_2, TargetTreeHeight2),
  %    ?debugVal(ResultPos2),
  %    {ok, Lookup2} = vtree:lookup(Fd2, ResultPos2, {0,0,1001,1001}),
  %    ?assertEqual(76, length(Lookup2)),
  
  
  %    % Test 3: input tree produces splits (recursively) (seedtree height=2)
  %    % It would create a root node with 5 nodes
  %    TargetTreeNodeNum3 = 196,
  %    TargetTreeHeight3 = log_n_ceil(4, TargetTreeNodeNum3),
  %    ?debugVal(TargetTreeHeight3),
  %    {Nodes3, Fd3, RootPos3} = create_random_nodes_and_packed_tree(
  %        12, TargetTreeNodeNum3, 4),
  %    Seedtree3_1 = seedtree_init(Fd3, RootPos3, 2),
  %    ?debugVal(Seedtree3_1),
  %    Seedtree3_2 = seedtree_insert_list(Seedtree3_1, Nodes3),
  %    {ok, ResultPos3} = seedtree_write(Fd3, Seedtree3_2, TargetTreeHeight3),
  %    ?debugVal(ResultPos3),
  %    {ok, Lookup3} = vtree:lookup(Fd3, ResultPos3, {0,0,1001,1001}),
  %    ?assertEqual(208, length(Lookup3)),
      
  %    % Test 4: input tree produces splits (recursively) (seedtree height=3)
  %    TargetTreeNodeNum4 = 900,
  %    TargetTreeHeight4 = log_n_ceil(4, TargetTreeNodeNum4),
  %    ?debugVal(TargetTreeHeight4),
  %    {Nodes4, Fd4, RootPos4} = create_random_nodes_and_packed_tree(
  %        14, TargetTreeNodeNum4, 4),
  %    Seedtree4_1 = seedtree_init(Fd4, RootPos4, 3),
  %    ?debugVal(Seedtree4_1),
  %    Seedtree4_2 = seedtree_insert_list(Seedtree4_1, Nodes4),
  %    {ok, ResultPos4} = seedtree_write(Fd4, Seedtree4_2, TargetTreeHeight4),
  %    ?debugVal(ResultPos4),
  %    {ok, Lookup4} = vtree:lookup(Fd4, ResultPos4, {0,0,1001,1001}),
  %    ?assertEqual(914, length(Lookup4)),
  
      % Test 5: adding new data with height=4 (seedtree height=1)
      TargetTreeNodeNum5 = 800,
      TargetTreeHeight5 = log_n_ceil(4, TargetTreeNodeNum5),
      ?debugVal(TargetTreeHeight5),
  
negative.code:     {ok, ResultPos5} = seedtree_write(Fd5, Seedtree5_2, TargetTreeHeight5),
      ?debugVal(ResultPos5),
      {ok, Lookup5} = vtree:lookup(Fd5, ResultPos5, {0,0,1001,1001}),
      ?assertEqual(1051, length(Lookup5)).
  
  
  seedtree_write_case2() ->
      % Test "Case 2: input R-tree is not shorter than the level of the
      % target node" (chapter 6.2)
      % Test 2.1: input tree is too height
      TargetTreeNodeNum = 25,
      % NOTE vmx: wonder why this tree is not really dense
      {ok, {Fd, {RootPos, TargetTreeHeight}}} = vtree_test:build_random_tree(
              "/tmp/seedtree_write.bin", TargetTreeNodeNum),
  
      ?debugVal(RootPos),
      Nodes1 = lists:foldl(fun(I, Acc) ->
          {NodeId, {NodeMbr, NodeMeta, NodeData}} =
              vtree_test:random_node({I,27+I*329,45}),
          Node = {NodeMbr, NodeMeta, {[NodeId, <<"bulk">>], NodeData}},
          [Node|Acc]
      end, [], lists:seq(1,12)),
  
      Seedtree1 = seedtree_init(Fd, RootPos, 1),
      ?debugVal(Seedtree1),
      Seedtree2 = seedtree_insert_list(Seedtree1, Nodes1),
      {ok, ResultPos1} = seedtree_write(Fd, Seedtree2, TargetTreeHeight),
      ?debugVal(ResultPos1),
      {ok, Lookup1} = vtree:lookup(Fd, ResultPos1, {0,0,1001,1001}),
      ?assertEqual(45, length(Lookup1)),
  
  
  ok.
  
  
  % @doc Loads nodes from file
  