anchor.diff:  
   %%TODO: there is a lot of similarities with do_query/3
   do_scan({UserRequest}, {Acc, AccLen}, Opts) ->
  -    ExclusiveStartKey = case proplists:get_value(<<"ExclusiveStartKey">>, UserRequest) of
  -                            undefined ->
  -                                [];
  -                            StartKey ->
  -                                [{<<"ExclusiveStartKey">>, StartKey}]
  -                        end,
  -
  -    Request = {ExclusiveStartKey ++ UserRequest},
  -
  +    Request = prepare_query(UserRequest, Opts),
       IsCount = proplists:get_value(<<"Select">>, UserRequest) =:= <<"COUNT">>,
       Accumulate = case IsCount of
                        true ->
  
positive.code:                          true -> proplists:get_value(<<"Count">>, Response);
                           false -> proplists:get_value(<<"Items">>, Response)
                       end,
              case proplists:get_value(<<"LastEvaluatedKey">>, Response) of
                  undefined ->
                      {ResultAcc, _} = Accumulate(Result, {Acc, AccLen}),
                      case proplists:is_defined(max_items, Opts) of
                          true ->
                              %% we hit last page of results
                              {ok, ResultAcc, undefined};
                          false ->
                              {ok, ResultAcc}
                      end;
                  LastEvaluatedKey ->
                      {NewAcc, NewLen} = Accumulate(Result, {Acc, AccLen}),
                      case proplists:get_value(max_items, Opts, infinity) > NewLen of
                          true ->
                              NextRequest = {lists:keystore(
                                               <<"ExclusiveStartKey">>, 1,
                                               UserRequest,
                                               {<<"ExclusiveStartKey">>, LastEvaluatedKey})},
                              do_scan(NextRequest, {NewAcc, NewLen}, Opts);
                          false ->
                              {ok, NewAcc, LastEvaluatedKey}
                      end
  
              end;
  
          {error, Reason} ->
              {error, Reason}
      end.
  
  
  
  
  
  
  
  
  %%
  %% INTERNALS
  %%
  
  -spec retry(target(), request(), [any()]) -> {ok, _} | {error, _}.
  retry(Op, Request, Opts) ->
  
negative.code: 
  %%TODO: there is a lot of similarities with do_scan/3
  do_query({UserRequest}, {Acc, AccLen}, Opts) ->
      Request = prepare_query(UserRequest, Opts),
      IsCount = proplists:get_value(<<"Select">>, UserRequest) =:= <<"COUNT">>,
      Accumulate = case IsCount of
                       true ->
  