anchor.diff:  
   %% gen_server callbacks
   init(Bucket) ->
  +    timer:send_after(1000, rebalance_if_new),
  +    timer:send_interval(10000, janitor),
       {ok, #state{bucket=Bucket}}.
   
  -handle_call(rebalance_progress, _From, State = #state{rebalancer = {_Pid, _Ref}, rebalance_progress = Progress}) ->
  +handle_call(rebalance_progress, _From, State = #state{rebalancer = {_Pid, _Ref},
  +                                                      progress = Progress}) ->
       {reply, {running, Progress}, State};
  -handle_call(rebalance_progress, _From, State = #state{}) ->
  +handle_call(rebalance_progress, _From, State) ->
       {reply, not_running, State};
  -handle_call({start_rebalance, KeepNodes, EjectNodes}, _From, State = #state{bucket=Bucket, rebalancer=undefined}) ->
  +handle_call({start_rebalance, KeepNodes, EjectNodes}, _From,
  +            State = #state{bucket=Bucket, rebalancer=undefined}) ->
       {_NumReplicas, _NumVBuckets, Map, Servers} = ns_bucket:config(Bucket),
       Histograms = histograms(Map, Servers),
       case {lists:sort(Servers), lists:sort(KeepNodes), EjectNodes,
             unbalanced(Histograms)} of
           {S, S, [], false} ->
  +            error_loger:info_msg("ns_orchestrator not rebalancing because already_balanced~n~p~n",
  +                                [{Servers, KeepNodes, EjectNodes, Histograms}]),
               {reply, already_balanced, State};
           _ ->
  -            {ok, Pid, Ref} = misc:spawn_link_safe(
  -                               fun () -> spawn_link(
  -                                           fun() ->
  -                                                   do_rebalance(Bucket, KeepNodes, EjectNodes, Map)
  -                                           end)
  -                               end),
  -            {reply, ok, State#state{rebalancer={Pid, Ref}, rebalance_progress=[]}}
  +            {ok, Pid, Ref} =
  +                misc:spawn_link_safe(
  +                  fun () ->
  +                          spawn_link(
  +                            fun() ->
  +                                    do_rebalance(Bucket, KeepNodes, EjectNodes, Map)
  +                            end)
  +                  end),
  +            {reply, ok, State#state{rebalancer={Pid, Ref}, progress=[]}}
       end;
   handle_call({start_rebalance, _, _}, _From, State) ->
  +    error_logger:info_msg("ns_orchestrator not rebalancing because in_progress~n", []),
       {reply, in_progress, State};
   handle_call(stop_rebalance, _From, State = #state{rebalancer={Pid, Ref}}) ->
       Pid ! stop,
  
positive.code: 
  %% Constants and definitions
  
  -define(INTERVAL, 5000).
  
  -record(state, {bucket, janitor, rebalancer, rebalance_progress}).
  
  %% API
  -export([start_link/1]).
  
  -export([needs_rebalance/1, rebalance_progress/1, start_rebalance/3, stop_rebalance/1]).
  
  %% gen_server callbacks
  -export([init/1, handle_call/3, handle_cast/2,
  
negative.code: %% Internal functions
  assign(Histogram, AvoidNodes) ->
      Histogram1 = lists:keysort(2, Histogram),
      case lists:splitwith(fun ({N, _}) -> lists:member(N, AvoidNodes) end,
                           Histogram1) of
          {Head, [{Node, N}|Rest]} ->
              {Node, Head ++ [{Node, N+1}|Rest]};
          {_, []} ->
              {undefined, Histogram1}
      end.
  
  balance_masters(Bucket, Map, Histograms) ->
      Masters = [Master || [Master|_] <- Map],
      [MHist|_] = Histograms,
      balance_masters(Bucket, Masters, MHist, []).
  
  balance_masters(Bucket, Masters, MHist, Moves) ->
      {MinNode, MinCount} = misc:keymin(2, MHist),
      {MaxNode, MaxCount} = misc:keymax(2, MHist),
      error_logger:info_msg("~p:balance_masters() ~p ~p ~p ~p ~p ~p~n",
                            [?MODULE, Masters, MHist, MinNode, MinCount, MaxNode, MaxCount]),
      case MaxCount - MinCount > 1 of
          true ->
              VBucket = misc:position(MaxNode, Masters) - 1,
              Masters1 = misc:nthreplace(VBucket+1, MinNode, Masters),
              MHist1 = lists:keyreplace(MinNode, 1, MHist, {MinNode, MinCount + 1}),
              MHist2 = lists:keyreplace(MaxNode, 1, MHist1, {MaxNode, MaxCount - 1}),
              balance_masters(Bucket, Masters1, MHist2,
                              [{VBucket, MaxNode, MinNode}|Moves]);
          false ->
              Moves
      end.
  
  do_rebalance(Bucket, KeepNodes, EjectNodes, Map) ->
  