anchor.diff:      commit(Node).
   
   staged_replace(Node, Node1, Node2) ->
  -    try
  -        Response = remote(Node, riak_core_claimant, replace, [Node1, Node2]),
  -        case Response of
  -            ok ->
  -                [{control, [{success, ok}]}];
  -            {error, R} ->
  -                [{control, [{error, R}]}]
  -        end
  -    catch
  -        Exception:Reason ->
  -            Error = list_to_binary(io_lib:format("~p:~p", [Exception,Reason])),
  -            [{control, [{error, Error}]}]
  -    end.
  +    handle_error(fun () ->
  +                         Response = remote(Node, riak_core_claimant, replace, [Node1, Node2]),
  +                         case Response of
  +                             ok ->
  +                                 [{control, [{success, ok}]}];
  +                             {error, R} ->
  +                                 [{control, [{error, R}]}]
  +                         end
  +                 end).
   
   join(Node, Node1) ->
       Response = remote(Node, riak_core, join, [Node1]),
  
positive.code:     [{control, Result}].
  
  force_replace(Node, Node1, Node2) ->
      try
          Response = remote(Node, riak_core_claimant, force_replace, [Node1, Node2]),
          case Response of
              ok ->
                  [{control, [{success, ok}]}];
              {error, R} ->
                  [{control, [{error, R}]}]
          end
      catch
          Exception:Reason ->
              Error = list_to_binary(io_lib:format("~p:~p", [Exception,Reason])),
              [{control, [{error, Error}]}]
      end.
  
  replace(Node, Node1, Node2) ->
      force_replace(Node, Node1, Node2),
  
negative.code:     end.
  
  transfers(Node) ->
      handle_error(fun () ->
                           {Down, Pending} = remote(Node, riak_core_status, transfers, []),
                           F = fun({waiting_to_handoff, WaitingNode, Count}, {Waiting, Stopped}) ->
                                       {[{WaitingNode, Count} | Waiting], Stopped};
                                  ({stopped, StoppedNode, Count}, {Waiting, Stopped}) ->
                                       {Waiting, [{StoppedNode, Count} | Stopped]}
                               end,
                           {Waiting, Stopped} = lists:foldl(F, {[], []}, Pending),
                           {Xfers, Down} = remote(Node, riak_core_status, all_active_transfers, []),
                           ActiveTransfers = [get_active_transfers(Xfer) || Xfer <- lists:flatten(Xfers)],
                           [{control, [{down, Down},
                                       {waiting_to_handoff, Waiting},
                                       {stopped, Stopped},
                                       {active, ActiveTransfers}]}]
                   end).
  
  aae_status(Node) ->
      handle_error(fun () ->
                           ExchangeInfo = remote(Node, riak_kv_entropy_info, compute_exchange_info, []),
                           Exchanges = [[{index, Index},
                                         {last_ts, datetime_str(LastTS)},
                                         {all_ts, datetime_str(AllTS)}] || {Index, LastTS, AllTS, _Repairs} <- ExchangeInfo],
                           TreeInfo = remote(Node, riak_kv_entropy_info, compute_tree_info, []),
                           Trees = [[{index, Index},
                                     {built_ts, datetime_str(BuiltTS)}] || {Index, BuiltTS} <- TreeInfo],
                           KeysRepaired = [[{index, Index},
                                            {last, Last},
                                            {max, Max},
                                            {mean, Mean}] || {Index, _, _, {Last,_Min,Max,Mean}} <- ExchangeInfo],
                           [{control, [{exchanges, Exchanges},
                                       {entropy_trees, Trees},
                                       {keys_repaired, KeysRepaired}]}]
                   end).
  
  %%%===================================================================
  %%% Riak Client API
  