anchor.diff:  	    {error, bad_date}
       end.
   
  +success(Result) ->
  +    io:format("Success: ~p", [Result]),
  +    ok.
  +
  +error(Reason) ->
  +    io:format("Error: ~p", [Reason]),
  +    error.
  +
   %%
   %% Org
   %%
   action(org, add, Args) ->
       {[[Name]], Metadata} = getopt(["name"], Args),
  -    call(org, add, [#uce_org{name=Name, metadata=Metadata}]);
  +    case call(org, add, [#uce_org{name=Name, metadata=Metadata}]) of
  +	{ok, created} ->
  +	    success(created);
  +	{error, Reason} ->
  +	    error(Reason)
  +    end;
   
   action(org, get, Args) ->
       {[[Name]], _} = getopt(["name"], Args),
  -    Response = call(org, get, [Name]),
  -    format(Response, record_info(fields, uce_org));
  +    case call(org, get, [Name]) of
  +	{ok, Record} ->
  +	    display(json, Record, record_info(fields, uce_org));
  +	{error, Reason} ->
  +	    error(Reason)
  +    end;
   
   action(org, update, Args) ->
       {[[Name]], Metadata} = getopt(["name"], Args),
  -    call(org, update, [#uce_org{name=Name, metadata=Metadata}]);
  +    case call(org, update, [#uce_org{name=Name, metadata=Metadata}]) of
  +	{ok, updated} ->
  +	    success(updated);
  +	{error, Reason} ->
  +	    error(Reason)
  +    end;
   
   action(org, delete, Args) ->
       {[[Name]], _} = getopt(["name"], Args),
  -    call(org, update, [Name]);
  +    case call(org, delete, [Name]) of
  +	{ok, deleted} ->
  +	    success(deleted);
  +	{error, Reason} ->
  +	   error(Reason)
  +    end;
  +
  +action(org, list, _Args) ->
  +    case call(org, list, []) of
  +	{ok, Records} ->
  +	    display(json, Records, record_info(fields, uce_org));
  +	{error, Reason} ->
  +	    error(Reason)
  +    end;
   
   %%
   %% Meeting
  
positive.code: 	    case catch action(list_to_atom(Object),
  			      list_to_atom(Action),
  			      args_to_dictionary(Command)) of
  		{ok, nothing} ->
  		    nothing;
  		{ok, Result} ->
  		    io:format("Success: ~p~n", [Result]);
  		{error, Reason} ->
  		    io:format("Error: ~p~n", [Reason]);
  		Exception when is_list(Exception) ->
  		    io:format("Fatal: " ++ Exception ++ "~n");
  		Exception ->
  		    io:format("Fatal: ~p~n", [Exception])
  	    end;
  	A ->
  	    usage()
      end,
      halt().
  
negative.code:     Remaining = [{Key, string:join(Value, " ")} || {Key, Value} <- RawRemaining],
      {Values, Remaining}.
  
  json_escape(String) when is_list(String) ->
      re:replace(String, "\"", "\\\"", [{return, list}]);
  json_escape(Integer) when is_integer(Integer) ->
      Integer.
  
  display_metadata(json, []) ->
      [];
  display_metadata(json, [{Key, Value}|Tail]) ->
      io:format("        ~p: ~p", [json_escape(Key), json_escape(Value)]),
      case Tail of
  	[] ->
  	    io:format("~n");
  	_ ->
  	    io:format(",~n")
      end,
     display_metadata(json, Tail).
  
  display_field(json, [], []) ->
      [];
  display_field(json, [Value|Values], [Field|Fields]) ->
      case Field of
  	metadata ->
  	    io:format("    \"metadata\": {~n"),
  	    display_metadata(json, Value),
  	    io:format("    }");
  	_ ->
  	    io:format("    ~p: ~p", [json_escape(atom_to_list(Field)),
  					     json_escape(Value)])
      end,
      case Fields of
  	[] ->
  	    io:format("~n");
  	_ ->
  	    io:format(",~n")
      end,
      display_field(json, Values, Fields).
  
  display(json, Records, Fields) when is_list(Records) ->
      io:format("["),
      [display(json, Record, Fields) || Record <- Records],
      io:format("]");
  display(json, Record, Fields) ->
      [_|Values] = tuple_to_list(Record),
      io:format("{~n"),
      display_field(json, Values, Fields),
      io:format("}");
  
  display(erlang, Record, _) ->
      io:format("~p~n", [Record]).    
      
  call(Object, Action, Args) ->
      Module = list_to_atom("uce_" ++ atom_to_list(Object)),
      NodeStr = "ucengine@localhost",
  