anchor.diff:          find_first_gteq(Bt, Tuple, Start, Mid, Key)
       end.
   
  -modify_kvnode(Bt, NodeTuple, LowerBound, [], ResultNode, QueryOutput) ->
  -    {ok, lists:reverse(ResultNode, bounded_tuple_to_list(NodeTuple, LowerBound, tuple_size(NodeTuple), [])), QueryOutput, Bt};
  +modify_kvnode(_Bt, NodeTuple, LowerBound, [], ResultNode, QueryOutput) ->
  +    {ok, lists:reverse(ResultNode, bounded_tuple_to_list(NodeTuple, LowerBound, tuple_size(NodeTuple), [])), QueryOutput};
   modify_kvnode(Bt, NodeTuple, LowerBound, [{ActionType, ActionKey, ActionValue} | RestActions], ResultNode, QueryOutput) when LowerBound > tuple_size(NodeTuple) ->
       case ActionType of
       insert ->
  
positive.code:     true  ->
          % perform remaining actions on last node
          {_, PointerInfo} = element(Sz, NodeTuple),
          {ok, ChildKPs, QueryOutput2, Bt2} =
              modify_node(Bt, PointerInfo, Actions, QueryOutput),
          NodeList = lists:reverse(ResultNode, bounded_tuple_to_list(NodeTuple, LowerBound,
              Sz - 1, ChildKPs)),
          {ok, NodeList, QueryOutput2, Bt2};
      false ->
          {NodeKey, PointerInfo} = element(N, NodeTuple),
          SplitFun = fun({_ActionType, ActionKey, _ActionValue}) ->
                  not less(Bt, NodeKey, ActionKey)
              end,
          {LessEqQueries, GreaterQueries} = lists:splitwith(SplitFun, Actions),
          {ok, ChildKPs, QueryOutput2, Bt2} =
                  modify_node(Bt, PointerInfo, LessEqQueries, QueryOutput),
          ResultNode2 = lists:reverse(ChildKPs, bounded_tuple_to_revlist(NodeTuple,
                  LowerBound, N - 1, ResultNode)),
          modify_kpnode(Bt2, NodeTuple, N+1, GreaterQueries, ResultNode2, QueryOutput2)
      end.
  
  bounded_tuple_to_revlist(_Tuple, Start, End, Tail) when Start > End ->
  
negative.code:     end,
      NodeTuple = list_to_tuple(NodeList),
  
      {ok, NewNodeList, QueryOutput2} =
      case NodeType of
      kp_node -> modify_kpnode(Bt, NodeTuple, 1, Actions, [], QueryOutput);
      kv_node -> modify_kvnode(Bt, NodeTuple, 1, Actions, [], QueryOutput)
      end,
      case NewNodeList of
      [] ->  % no nodes remain
          {ok, [], QueryOutput2};
      NodeList ->  % nothing changed
          {LastKey, _LastValue} = element(tuple_size(NodeTuple), NodeTuple),
          {ok, [{LastKey, RootPointerInfo}], QueryOutput2};
      _Else2 ->
          {ok, ResultList} = write_node(Bt, NodeType, NewNodeList),
          {ok, ResultList, QueryOutput2}
      end.
  
  reduce_node(#btree{reduce=nil}, _NodeType, _NodeList) ->
  