anchor.diff:  
   -define(SCRIPT_NAME, "riak-cs-gc").
   
  +%%%===================================================================
  +%%% Public API
  +%%%===================================================================
  +
   %% @doc Kick off a gc round, unless one is already
   %% in progress.
   batch(_Opts) ->
  -    ?SAFELY(
  -       case riak_moss_gc_d:manual_batch([]) of
  -           ok ->
  -               io:format("Garbage collection batch started.~n"),
  -               ok;
  -           {error, already_deleting} ->
  -               io:format("Error: A garbage collection batch"
  -                         " is already in progress.~n"),
  -               error
  -       end,
  -       "Starting garbage collection batch").
  +    ?SAFELY(start_batch(), "Starting garbage collection batch").
   
   %% @doc Find out what the gc daemon is up to.
   status(_Opts) ->
  -    ?SAFELY(
  -       begin
  -           {ok, {State, Details}} = riak_moss_gc_d:status(),
  -           print_state(State),
  -           print_details(Details)
  -       end,
  -       "Checking garbage collection status").
  +    ?SAFELY(get_status(), "Checking garbage collection status").
  +
  +cancel(_Opts) ->
  +    ?SAFELY(cancel_batch(), "Canceling the garbage collection batch").
  +
  +pause(_Opts) ->
  +    ?SAFELY(pause_batch(), "Pausing the garbage collection batch").
  +
  +resume(_Opts) ->
  +    ?SAFELY(resume_batch(), "Resuming the garbage collection batch").
  +
  +%%%===================================================================
  +%%% Internal functions
  +%%%===================================================================
  +
  +start_batch() ->
  +    handle_batch_start(riak_cs_gc_d:manual_batch([])).
  +
  +get_status() ->
  +    handle_status(riak_cs_gc_d:status()).
  +
  +pause_batch() ->
  +    handle_batch_pause(riak_cs_gc_d:pause_batch()).
  +
  +cancel_batch() ->
  +    handle_batch_cancellation(riak_cs_gc_d:cancel_batch()).
  +
  +resume_batch() ->
  +    handle_batch_resumption(riak_cs_gc_d:resume_batch()).
  +
  +handle_batch_start(ok) ->
  +    output("Garbage collection batch started."),
  +    ok;
  +handle_batch_start({error, already_deleting}) ->
  +    output("Error: A garbage collection batch"
  +           " is already in progress."),
  +    error.
  +
  +handle_status({ok, {State, Details}}) ->
  +    print_status(State, Details);
  +handle_status(_) ->
  +    ok.
  +
  +handle_batch_pause(ok) ->
  +    output("The garbage collection batch was paused.");
  +handle_batch_pause({error, no_batch}) ->
  +    output("No garbage collection batch was running.").
  +
  +handle_batch_cancellation(ok) ->
  +    output("The garbage collection batch was canceled.");
  +handle_batch_cancellation({error, no_batch}) ->
  +    output("No garbage collection batch was running.").
  +
  +handle_batch_resumption(ok) ->
  +    output("The garbage collection batch was resumed.");
  +handle_batch_resumption({error, no_batch}) ->
  +    output("No garbage collection batch was running.").
  +
  +output(Output) ->
  +    io:format(Output ++ "~n").
  +
  +print_status(State, Details) ->
  +    print_state(State),
  +    print_details(Details).
   
   print_state(idle) ->
  -    io:format("There is no garbage collection in progress~n");
  -print_state(calculating) ->
  -    io:format("A garbage collection batch is in progress~n");
  +    output("There is no garbage collection in progress");
  +print_state(fetching_next_filest) ->
  +    output("A garbage collection batch is in progress");
  +print_state(initiating_file_delete) ->
  +    output("A garbage collection batch is in progress");
  +print_state(waiting_filel_delete) ->
  +    output("A garbage collection batch is in progress");
   print_state(paused) ->
  -    io:format("A garbage collection batch is currently paused~n").
  -
  -cancel(_Opts) ->
  -    ?SAFELY(
  -       case riak_moss_gc_d:cancel_batch() of
  -           ok ->
  -               io:format("The garbage collection batch was canceled.~n");
  -           {error, no_batch} ->
  -               io:format("No garbage collection batch was running.~n")
  -       end,
  -       "Canceling the garbage collection batch").
  -
  -pause(_Opts) ->
  -    ?SAFELY(
  -       case riak_moss_gc_d:pause_batch() of
  -           ok ->
  -               io:format("The garbage collection batch was paused.~n");
  -           {error, no_batch} ->
  -               io:format("No garbage collection batch was running.~n")
  -       end,
  -       "Pausing the garbage collection batch").
  -
  -resume(_Opts) ->
  -    ?SAFELY(
  -       case riak_moss_gc_d:resume_batch() of
  -           ok ->
  -               io:format("The garbage collection batch was resumed.~n");
  -           {error, no_batch} ->
  -               io:format("No garbage collection batch was running.~n")
  -       end,
  -       "Resuming the garbage collection batch").
  +    output("A garbage collection batch is currently paused").
   
   %% @doc Pretty-print the status returned from the gc daemon.
   print_details(Details) ->
  
positive.code:       || {K, V} <- Details ].
  
  human_detail(interval, Interval) ->
      {"The current garbage collection interval is", Interval};
  human_detail(last, Time) ->
      {"Last run started at", human_time(Time)};
  human_detail(current, Time) ->
  
negative.code:     {io_lib:format("~p", [Name]), io_lib:format("~p", [Value])}.
  
  human_time(undefined) -> "unknown/never";
  human_time(Seconds) when is_integer(Seconds) ->
      human_time(calendar:gregorian_seconds_to_datetime(Seconds));
  human_time(Datetime)  -> rts:iso8601(Datetime).
  