anchor.diff:          "\n\n"
       ],
       {ok, Resp1} = chttpd:send_delayed_chunk(Resp, Chunk),
  -    {ok, {"eventsource", Resp1}};
  -changes_callback(timeout, {"eventsource", Resp}) ->
  +    {ok, Acc#cacc{mochi = Resp1}};
  +changes_callback(timeout, #cacc{feed = eventsource} = Acc) ->
  +    #cacc{mochi = Resp} = Acc,
       Chunk = "event: heartbeat\ndata: \n\n",
       {ok, Resp1} = chttpd:send_delayed_chunk(Resp, Chunk),
       {ok, {"eventsource", Resp1}};
  -changes_callback({stop, _EndSeq}, {"eventsource", Resp}) ->
  +changes_callback({stop, _EndSeq}, #cacc{feed = eventsource} = Acc) ->
  +    Resp = Acc#cacc.mochi,
       chttpd:end_delayed_json_response(Resp);
   
   % callbacks for longpoll and normal (single JSON Object)
  -changes_callback(start, {"normal", {"Etag", Etag}, Req}) ->
  +changes_callback(start, #cacc{feed = normal} = Acc) ->
  +    #cacc{etag = Etag, mochi = Req} = Acc,
       FirstChunk = "{\"results\":[\n",
       {ok, Resp} = chttpd:start_delayed_json_response(Req, 200,
           [{"Etag",Etag}], FirstChunk),
  -    {ok, {"", Resp}};
  -changes_callback(start, {_, Req}) ->
  +    {ok, Acc#cacc{mochi = Resp, responding = true}};
  +changes_callback(start, Acc) ->
  +    #cacc{mochi = Req} = Acc,
       FirstChunk = "{\"results\":[\n",
       {ok, Resp} = chttpd:start_delayed_json_response(Req, 200, [], FirstChunk),
  -    {ok, {"", Resp}};
  -changes_callback({change, Change}, {Prepend, Resp}) ->
  +    {ok, Acc#cacc{mochi = Resp, responding = true}};
  +changes_callback({change, Change}, Acc) ->
  +    #cacc{prepend = Prepend, mochi = Resp} = Acc,
       {ok, Resp1} = chttpd:send_delayed_chunk(Resp, [Prepend, ?JSON_ENCODE(Change)]),
  -    {ok, {",\r\n", Resp1}};
  -changes_callback({stop, EndSeq, Pending}, {_, Resp}) ->
  +    {ok, Acc#cacc{prepend = ",\r\n", mochi = Resp1}};
  +changes_callback({stop, EndSeq, Pending}, Acc) ->
  +    #cacc{mochi = Resp} = Acc,
       {ok, Resp1} = case is_old_couch(Resp) of
       true ->
           chttpd:send_delayed_chunk(Resp, "\n],\n\"last_seq\":0}\n");
  
positive.code:     end.
  
  % callbacks for continuous feed (newline-delimited JSON Objects)
  changes_callback(start, {"continuous", Req}) ->
      {ok, Resp} = chttpd:start_delayed_json_response(Req, 200),
      {ok, {"continuous", Resp}};
  changes_callback({change, Change}, {"continuous", Resp}) ->
      {ok, Resp1} = chttpd:send_delayed_chunk(Resp, [?JSON_ENCODE(Change) | "\n"]),
      {ok, {"continuous", Resp1}};
  changes_callback({stop, EndSeq0, Pending}, {"continuous", Resp}) ->
      EndSeq = case is_old_couch(Resp) of true -> 0; false -> EndSeq0 end,
      Row = {[
          {<<"last_seq">>, EndSeq},
  
negative.code:     chttpd:end_delayed_json_response(Resp1);
  
  % callbacks for eventsource feed (newline-delimited eventsource Objects)
  changes_callback(start, #cacc{feed = eventsource} = Acc) ->
      #cacc{mochi = Req} = Acc,
      Headers = [
          {"Content-Type", "text/event-stream"},
          {"Cache-Control", "no-cache"}
      ],
      {ok, Resp} = chttpd:start_delayed_json_response(Req, 200, Headers),
      {ok, Acc#cacc{mochi = Resp, responding = true}};
  changes_callback({change, {ChangeProp}=Change}, #cacc{feed = eventsource} = Acc) ->
      #cacc{mochi = Resp} = Acc,
      Seq = proplists:get_value(seq, ChangeProp),
      Chunk = [
          "data: ", ?JSON_ENCODE(Change),
  