anchor.diff:          case FilterName of
           "_doc_ids" when length(FilterArgs) =< ?MAX_DOC_IDS ->
               send_changes_doc_ids(
  -                FilterArgs, Db, StartSeq, fun changes_enumerator/2, Acc0);
  +                FilterArgs, Db, StartSeq, Dir, fun changes_enumerator/2, Acc0);
           "_design" ->
               send_changes_design_docs(
  -                Db, StartSeq, fun changes_enumerator/2, Acc0);
  +                Db, StartSeq, Dir, fun changes_enumerator/2, Acc0);
           _ ->
               couch_db:changes_since(
                   Db, StartSeq, fun changes_enumerator/2, [{dir, Dir}], Acc0)
  
positive.code:     end.
  
  
  send_changes_doc_ids(DocIds, Db, StartSeq, Fun, Acc0) ->
      Lookups = couch_btree:lookup(Db#db.fulldocinfo_by_id_btree, DocIds),
      DocInfos = lists:foldl(
          fun({ok, FDI}, Acc) ->
              DocInfo = couch_doc:to_doc_info(FDI),
              case DocInfo#doc_info.high_seq >= StartSeq of
              true ->
                  [DocInfo | Acc];
              false ->
                  Acc
              end;
          (not_found, Acc) ->
              Acc
          end,
          [], Lookups),
      send_lookup_changes(DocInfos, Db, Fun, Acc0).
  
  
  send_changes_design_docs(Db, StartSeq, Fun, Acc0) ->
      FoldFun = fun(FullDocInfo, _, Acc) ->
          DocInfo = couch_doc:to_doc_info(FullDocInfo),
          case DocInfo#doc_info.high_seq >= StartSeq of
          true ->
              {ok, [DocInfo | Acc]};
          false ->
              {ok, Acc}
          end
      end,
      KeyOpts = [{start_key, <<"_design/">>}, {end_key_gt, <<"_design0">>}],
      {ok, _, DocInfos} = couch_btree:fold(
          Db#db.fulldocinfo_by_id_btree, FoldFun, [], KeyOpts),
      send_lookup_changes(DocInfos, Db, Fun, Acc0).
  
  
  send_lookup_changes(DocInfos, Db, Fun, Acc0) ->
      SortedDocInfos = lists:keysort(#doc_info.high_seq, DocInfos),
      FinalAcc = try
          lists:foldl(
              fun(DocInfo, Acc) ->
                  case Fun(DocInfo, Acc) of
                  {ok, NewAcc} ->
  
negative.code:     throw:{stop, Acc} ->
          Acc
      end,
      case Dir of
      fwd ->
          {ok, FinalAcc#changes_acc{seq = couch_db:get_update_seq(Db)}};
      rev ->
          {ok, FinalAcc}
      end.
  
  
  keep_sending_changes(Args, Callback, UserAcc, Db, StartSeq, Prepend, Timeout,
  