anchor.diff:          {ok, {Seq, <<",\n">>, FilterFun, Resp, nil}}
       end.
   
  -send_changes(Req, Resp, Db, StartSeq, Prepend, ResponseType) ->
  +send_changes(Req, Resp, Db, StartSeq, Prepend, ResponseType, FilterFun, End) ->
       Style = list_to_existing_atom(
               couch_httpd:qs_value(Req, "style", "main_only")),
  -    {FilterFun, EndFilterFun} = make_filter_funs(Req, Db),
       try
           couch_db:changes_since(Db, Style, StartSeq, fun changes_enumerator/2,
               {StartSeq, Prepend, FilterFun, Resp, ResponseType})
       after
  -        EndFilterFun()
  +        End()
       end.
   
   make_filter_funs(Req, Db) ->
  
positive.code:         case wait_db_updated(Timeout, TimeoutFun) of
          updated ->
              {ok, Db2} = couch_db:open(DbName, [{user_ctx, UserCtx}]),
              keep_sending_changes(Req, Resp, Db2, EndSeq, Prepend2, Timeout, TimeoutFun, ResponseType);
          stop ->
              end_sending_changes(Resp, EndSeq, ResponseType)
          end
  
negative.code:         couch_stats_collector:track_process_count(Self,
                              {httpd, clients_requesting_changes}),
          try
              keep_sending_changes(Req, Resp, Db, StartSeq, <<"">>, Timeout,
                  TimeoutFun, ResponseType, FilterFun, EndFilterFun)
          after
              couch_db_update_notifier:stop(Notify),
              get_rest_db_updated() % clean out any remaining update messages
          end;
      true ->
          {ok, {LastSeq, _Prepend, _, _, _}} =
                  send_changes(Req, Resp, Db, StartSeq, <<"">>, "normal",
                      FilterFun, EndFilterFun),
          end_sending_changes(Resp, LastSeq, ResponseType)
      end;
  
  