anchor.diff:              {StateName, NewState} = send_batch(State),
               {next_state, StateName, NewState};
           RepliesLeft ->
  -            {next_state, receiving, State#state{replies_left = RepliesLeft}}
  +            {next_state, receiving, State#state{acks = Acks + 1,
  +                                                replies_left = RepliesLeft}}
       end;
  -receiving({Ref, recv_timeout}, #state{ref=Ref} = State) ->    
  +receiving({Ref, recv_timeout}, #state{timeouts=Timeouts,ref=Ref} = State) ->    
       %% Receive timeout for current batch - for now just continue
       %% on to the next batch
  -    {StateName, NewState} = send_batch(State#state{timer=undefined}),
  +    {StateName, NewState} = send_batch(State#state{timeouts=Timeouts+1,
  +                                                   timer=undefined}),
       {next_state, StateName, NewState};
   
  -receiving({_Ref, {indexed, _Partition}}, State) ->
  +receiving({_Ref, {indexed, _Node}}, State) ->
       %% Ignore stale reply from previous batch
       {next_state, receiving, State};
   receiving(empty, State) ->
  
positive.code: -spec add_terms(index_terms(), term(), #state{}) -> {overload_state(), #state{}}.
  add_terms(NewTerms, From, State) ->
      UpdTerms = State#state.terms ++ NewTerms,
      UpdNumTerms = State#state.num_terms + length(NewTerms),
      case UpdNumTerms < State#state.overload_thresh of
          true ->
              {ok, State#state{terms = UpdTerms,
  
negative.code: -define(RECV_TIMEOUT_USECS, 60000).
  -define(INDEX_TIMEOUT_USECS, 60000).
  
  -record(state, {total=0,           % Total number of terms sent to all vnodes
                  acks=0,            % Number of indexed messages received
                  timeouts=0,        % Number of timeout messages received
                  num_terms=0,       % Number of terms in the terms list below
                  ref,               % Reference for current batch of terms sent out
                  replies_left,      % Count of replies pending
                  timer,             % Timer reference for batch
                  overload_waiters=[], % List to reply to once out of overload
                  done_waiters=[],   % List to reply to once terms is empty
                  batch_size,        % Size of index batches to send
                  overload_thresh,   % Threshold for num_terms to trigger overload
                  terms=[]}).        % Terms left to index,
  
  
  -type index() :: term().
  