anchor.diff:                      [] ->
                           ok;
                       _ ->
  -                        [monitor(process, {ServerName, Node}) || Node <- NewNodes],
  -                        [replicate_change_to_node(Module, ServerName, S, D)
  +                        [monitor(process, {StorageFrontend, Node}) || Node <- NewNodes],
  +                        [replicate_change_to_node(Module, StorageFrontend, S, D)
                            || S <- NewNodes,
                               D <- Docs]
                   end,
                   AllNodes;
               {'$gen_call', From, {pull_docs, Nodes, Timeout}} ->
  -                gen_server:reply(From, handle_pull_docs(ServerName, Nodes, Timeout)),
  +                gen_server:reply(From, handle_pull_docs(StorageFrontend, Nodes, Timeout)),
                   RemoteNodes;
               {'DOWN', _Ref, _Type, {Server, RemoteNode}, Error} ->
                   ?log_warning("Remote server node ~p process down: ~p",
  
positive.code:                 exit({unexpected_message, Msg})
          end,
  
      loop(Module, GetNodes, ServerName, NewRemoteNodes).
  
  replicate_change_to_node(Module, ServerName, Node, Doc) ->
      ?log_debug("Sending ~p to ~p", [Module:get_id(Doc), Node]),
      gen_server:cast({ServerName, Node}, {replicated_update, Doc}).
  
  nodeup_monitoring_loop(Parent) ->
      receive
          {nodeup, _} ->
              ?log_debug("got nodeup event. Considering ddocs replication"),
              Parent ! replicate_newnodes_docs;
          _ ->
              ok
      end,
      nodeup_monitoring_loop(Parent).
  
  handle_pull_docs(ServerName, Nodes, Timeout) ->
      {RVs, BadNodes} = gen_server:multi_call(Nodes, ServerName, get_all_docs, Timeout),
      case BadNodes of
          [] ->
              lists:foreach(
                fun ({_N, Docs}) ->
                        [gen_server:cast(ServerName, {replicated_update, Doc}) ||
                            Doc <- Docs]
                end, RVs),
              gen_server:call(ServerName, sync, Timeout);
          _ ->
              {error, {bad_nodes, BadNodes}}
      end.
  
negative.code: 
  -export([start_link/4]).
  
  start_link(Module, Name, GetNodes, StorageFrontend) ->
      proc_lib:start_link(erlang, apply, [fun start_loop/4, [Module, Name, GetNodes, StorageFrontend]]).
  
  start_loop(Module, Name, GetNodes, StorageFrontend) ->
      erlang:register(Name, self()),
      proc_lib:init_ack({ok, self()}),
      LocalStoragePid = replicated_storage:wait_for_startup(),
  
      %% anytime we disconnect or reconnect, force a replicate event.
      erlang:spawn_link(
        fun () ->
                ok = net_kernel:monitor_nodes(true),
                nodeup_monitoring_loop(LocalStoragePid)
        end),
  
      %% Explicitly ask all available nodes to send their documents to us
      [{StorageFrontend, N} ! replicate_newnodes_docs ||
          N <- GetNodes()],
  
      loop(Module, GetNodes, StorageFrontend, []).
  
  loop(Module, GetNodes, StorageFrontend, RemoteNodes) ->
      NewRemoteNodes =
          receive
              {replicate_change, Doc} ->
                  [replicate_change_to_node(Module, StorageFrontend, Node, Doc)
                   || Node <- RemoteNodes],
                  RemoteNodes;
              {replicate_newnodes_docs, Docs} ->
  