anchor.diff:  decode_batch(Data, #sstate{hpts = false}) ->
       dproto_tcp:decode_batch(Data).
   
  -batch_loop(Socket, Transport, State = #sstate{
  -                                         dict_mod = DictMod,
  -                                         dict = Dict}, _Time,
  +batch_loop(Socket, Transport, State = #sstate{dict = Dict}, _Time,
              {batch_end, Acc}) ->
       %io:format("Batch end: ~p\n", [Dict]),
  -    Dict1 = flush(DictMod, Dict),
  +    Dict1 = flush(Dict),
       stream_loop(Socket, Transport, State#sstate{dict = Dict1},
                   dproto_tcp:decode_stream(Acc));
   
  -batch_loop(Socket, Transport, State  = #sstate{
  -                                          dict_mod = DictMod,
  -                                          dict = Dict}, Time,
  +batch_loop(Socket, Transport, State  = #sstate{dict = Dict}, Time,
              {{batch, Metric, Point}, Acc}) ->
  -    Dict1 = DictMod:add(Metric, Time, Point, Dict),
  +    Dict1 = bkt_pdict:add(Metric, Time, Point, Dict),
       batch_loop(Socket, Transport, State#sstate{dict = Dict1}, Time,
                  decode_batch(Acc, State));
   
  -batch_loop(Socket, Transport, State  = #sstate{
  -                                          dict_mod = DictMod,
  -                                          dict = Dict}, Time,
  +batch_loop(Socket, Transport, State  = #sstate{dict = Dict}, Time,
              {{batch_hpts, Metric, Point}, Acc}) ->
  -    Dict1 = DictMod:add(Metric, Time, Point, Dict),
  +    Dict1 = bkt_pdict:add(Metric, Time, Point, Dict),
       batch_loop(Socket, Transport, State#sstate{dict = Dict1}, Time,
                  decode_batch(Acc, State));
   
   
  -batch_loop(Socket, Transport, State = #sstate{dict_mod = DictMod},
  -           Time, {incomplete, Acc}) ->
  +batch_loop(Socket, Transport, State, Time, {incomplete, Acc}) ->
       case Transport:recv(Socket, 0, 1000) of
           {ok, Data} ->
               Acc1 = <<Acc/binary, Data/binary>>,
  
positive.code:                          ok.
  stream_loop(Socket, Transport,
              State = #sstate{
                         dict_mod = DictMod,
                         dict = Dict},
              {flush, Rest}) ->
      Dict1 = flush(DictMod, Dict),
      stream_loop(Socket, Transport, State#sstate{dict = Dict1},
                  dproto_tcp:decode_stream(Rest));
  
  stream_loop(Socket, Transport,
              State = #sstate{dict = Dict, last = undefined,
                              dict_mod = DictMod,
                              max_bkt_batch_size = BDSize},
              {{stream, Metric, Time, Points}, Rest}) ->
      Dict1 = DictMod:add(Metric, Time, Points, Dict),
      Dict2 = case DictMod:size(Dict1) of
                  X when X > BDSize ->
                      flush(DictMod, Dict1);
                  _ ->
                      Dict1
              end,
  
negative.code:                         State#sstate{recv_size = max(0, Size - 512)},
                          {incomplete, Acc});
          {error, closed} ->
              bkt_pdict:flush(State#sstate.dict),
              ok;
          E ->
              error(E, Transport, Socket, State)
  