anchor.diff:  %%%============================================================================
   %%% Internal functions
   %%%============================================================================
  -handle_fac_command(From, To, Arg) ->
  -    case try_parse_int(Arg) of
  -        {ok, Int} -> 
  -            F = fac(Int),
  -            nani_bot:say(To, [From, ": ", integer_to_list(F)]);
  -        {error, _} -> 
  -            nani_bot:say(To, [From, ": ", Arg, " is not a valid integer."])
  +unknown_command(From, To, Cmd) ->
  +    nani_bot:say(To, [From, ": ", "unknown command '", Cmd, "'"]).
  +
  +apply_command(From, To, {M, F, A}) ->
  +    case apply(M, F, A) of 
  +        {ok, Str} -> 
  +            nani_bot:say(To, [From, ": ", Str]);
  +        Err -> 
  +            Msg = io_lib:format("~p", [Err]),
  +            nani_bot:say(To, [From, ": ", Msg])
       end.
   
  -handle_fmt_command(From, To, Fmt, Arg) ->
  +handle_fac_command(Arg) ->
       case try_parse_int(Arg) of
  -        {ok, Int} ->
  -            case try_fmt_arg(Fmt, Int) of
  -                {ok, Str} ->
  -                    nani_bot:say(To, [From, ": ", Str]);
  -                {error, _} ->
  -                    nani_bot:say(To, [From, ": ", Fmt, " is not a valid format string."])
  -            end;
  -        {error, _} ->
  -            nani_bot:say(To, [From, ": ", Arg, " is not a valid integer."])
  +        {ok, Int} -> F = fac(Int), {ok, integer_to_list(F)};
  +        Err -> Err
  +    end. 
  +
  +handle_fmt_command(Fmt, Arg) ->
  +    case try_parse_int(Arg) of
  +        {ok, Int} -> try_fmt_arg(Fmt, Int);
  +        Err -> Err
       end.
   
  -handle_fread_command(From, To, Fmt, Arg) ->
  +handle_fread_command(Fmt, Arg) ->
       case try_fread_arg(Fmt, Arg) of
  -        {ok, Val} ->
  -            nani_bot:say(To, [From, ": ", integer_to_list(Val)]);
  -        {error, _} ->
  -            nani_bot:say(To, [From, ": ", " either the format string or argument doesn't make sense."])
  +        {ok, Val} -> {ok, integer_to_list(Val)};
  +        Err -> Err
       end.
   
   try_fread_arg(Fmt, Arg) ->
  
positive.code: init([]) -> {ok, []}.
  
  handle_event({cmd, _Bot, From, To, Cmd}, State) ->
      Str = binary_to_list(Cmd),
      Tokens = lists:map(fun string:to_lower/1, string:tokens(Str, " ")),
      case Tokens of
          ["fac", Arg] -> 
              handle_fac_command(From, To, Arg);
          ["fmt", Fmt, Arg] ->
              handle_fmt_command(From, To, Fmt, Arg);
          ["fread", Fmt, Arg] ->
              handle_fread_command(From, To, Fmt, Arg);
          _ -> void
      end,
      {ok, State};
  
  
negative.code:     end.
  
  fac(0) -> 1;
  fac(N) -> N * fac(N - 1).
  
  parse_cmd(Cmd) ->
     Str = binary_to_list(Cmd),
     lists:map(fun string:to_lower/1, string:tokens(Str, " ")).