anchor.diff:      case UngroupedNodes of
       [{_Key, NodeInfo}|RestNodes] ->
           {ok, Acc2, GroupedRedsAcc2, GroupedKVsAcc2, GroupedKey2} =
  -            reduce_stream_node(Bt, Dir, NodeInfo, KeyStart, KeyEnd, GroupedKey,
  +            reduce_stream_node(Bt, Dir, NodeInfo, KeyStart, InEndRangeFun, GroupedKey,
                   GroupedKVsAcc, GroupedReds ++ GroupedRedsAcc, KeyGroupFun, Fun, Acc),
  -        reduce_stream_kp_node2(Bt, Dir, RestNodes, KeyStart, KeyEnd, GroupedKey2,
  +        reduce_stream_kp_node2(Bt, Dir, RestNodes, KeyStart, InEndRangeFun, GroupedKey2,
                   GroupedKVsAcc2, GroupedRedsAcc2, KeyGroupFun, Fun, Acc2);
       [] ->
           {ok, Acc, GroupedReds ++ GroupedRedsAcc, GroupedKVsAcc, GroupedKey}
  
positive.code:     undefined ->
          NodeList;
      _ ->
          lists:dropwhile(
              fun({Key,_}) ->
                  less(Bt, Key, KeyStart)
              end, NodeList)
      end,
      NodesInRange =
      case KeyEnd of
      undefined ->
          Nodes;
      _ ->
          {InRange, MaybeInRange} = lists:splitwith(
              fun({Key,_}) ->
                  less(Bt, Key, KeyEnd)
              end, Nodes),
          InRange ++ case MaybeInRange of [] -> []; [FirstMaybe|_] -> [FirstMaybe] end
      end,
      reduce_stream_kp_node2(Bt, Dir, adjust_dir(Dir, NodesInRange), KeyStart, KeyEnd,
          GroupedKey, GroupedKVsAcc, GroupedRedsAcc, KeyGroupFun, Fun, Acc).
  
  
  reduce_stream_kp_node2(Bt, Dir, [{_Key, NodeInfo} | RestNodeList], KeyStart, KeyEnd,
                          undefined, [], [], KeyGroupFun, Fun, Acc) ->
      {ok, Acc2, GroupedRedsAcc2, GroupedKVsAcc2, GroupedKey2} =
              reduce_stream_node(Bt, Dir, NodeInfo, KeyStart, KeyEnd, undefined,
                  [], [], KeyGroupFun, Fun, Acc),
      reduce_stream_kp_node2(Bt, Dir, RestNodeList, KeyStart, KeyEnd, GroupedKey2,
              GroupedKVsAcc2, GroupedRedsAcc2, KeyGroupFun, Fun, Acc2);
  reduce_stream_kp_node2(Bt, Dir, NodeList, KeyStart, KeyEnd,
          GroupedKey, GroupedKVsAcc, GroupedRedsAcc, KeyGroupFun, Fun, Acc) ->
      {Grouped0, Ungrouped0} = lists:splitwith(fun({Key,_}) ->
          KeyGroupFun(GroupedKey, Key) end, NodeList),
  
negative.code:     undefined ->
          KVs;
      _ ->
          DropFun = case Dir of
          fwd ->
              fun({Key, _}) -> less(Bt, Key, KeyStart) end;
          rev ->
              fun({Key, _}) -> less(Bt, KeyStart, Key) end
          end,
          lists:dropwhile(DropFun, KVs)
      end,
      KVs2 = lists:takewhile(
          fun({Key, _}) -> InEndRangeFun(Key) end, GTEKeyStartKVs),
      reduce_stream_kv_node2(Bt, KVs2, GroupedKey, GroupedKVsAcc, GroupedRedsAcc,
                          KeyGroupFun, Fun, Acc).
  
  
  