anchor.diff:      {ok, Body} ->
         lists:flatten(Body);
       {error, Error} ->
  -      error_logger:error_msg("Could not JSON serialize the request body: ~p (~p)~n", [Error, Payload]),
  -      rabbit:stop_and_halt()
  -  end.
  -
  -
  -%% @private
  -%% @spec build_registration_body(Service, Name, Port) -> list()
  -%% @where Service = list(), Name = list()|undefined, Port = list()|undefined
  -%% @doc Return a property list with the payload data structure for registration
  -%% @end
  -%%
  -build_registration_body(Service, undefined, undefined, _) ->
  -  [{"ID", Service}, {"Name", Service}];
  -build_registration_body(Service, Name, undefined, _) ->
  -  [{"ID", Service}, {"Name", Service}, {"Tags", [list_to_atom(Name)]}];
  -build_registration_body(Service, undefined, Port, TTL) ->
  -  [{"ID", Service}, {"Name", Service}, {"Port", Port}, {"Check", [{"Notes", ?NOTES}, {"TTL", ttl_string(TTL)}]}];
  -build_registration_body(Service, Name, Port, TTL) ->
  -  [{"ID", Service}, {"Name", Service}, {"Port", Port}, {"Tags", [list_to_atom(Name)]}, {"Check", [{"Notes", ?NOTES}, {"TTL", ttl_string(TTL)}]}].
  -
  -
  -%% @private
  -%% @spec host_sname(binary()) -> list()
  -%% @doc Return the hostname/sname from the specified value
  -%% @end
  -%%
  -host_sname(Value) ->
  -  Parts = string:tokens(binary_to_list(Value), "."),
  -  case length(Parts) of
  -    1 -> Value;
  -    _ -> lists:nth(1, Parts)
  +      err("Could not JSON serialize the request body: ~p (~p)~n", [Error, Payload]),
  +      {error, Error}
     end.
   
   
  
positive.code: %% @end
  %%
  init() ->
    io:format("~n              Consul Cluster Initializing: "),
    case register() of
      ok ->
        io:format("Node registered~n");
      {error, 400} ->
        io:format("permission denied when registering node with Consul, did you provide a ACL token?~n"),
        rabbit:stop_and_halt();
      {error, Error} ->
        io:format("Error registering: ~p~n", [Error]),
        rabbit:stop_and_halt()
    end,
    send_check_pass(),
    Interval = autocluster_consul_config:service_ttl() * 1000,
    {ok, _} = timer:apply_interval(Interval, ?MODULE, send_check_pass, []),
    Nodes = cluster_nodes(),
    case lists:member(node(), Nodes) of
      true -> ok;
      false -> join_cluster(Nodes)
    end.
  
  
  
negative.code: 
  
  %% @private
  %% @spec host_sname(binary()) -> list()
  %% @doc Return the hostname/sname from the specified value
  %% @end
  %%
  host_sname(Value) ->
    Parts = string:tokens(binary_to_list(Value), "."),
    case length(Parts) of
      1 -> binary_to_list(Value);
      _ -> binary_to_list(lists:nth(1, Parts))
    end.
  
  
  %% @private
  %% @spec build_registration_body(Service, Name, Port) -> list()
  %% @where Service = list(), Name = list()|undefined, Port = list()|undefined
  %% @doc Return a property list with the payload data structure for registration
  %% @end
  %%
  build_registration_body(Service, undefined, undefined, _) ->
    [{"ID", Service}, {"Name", Service}];
  build_registration_body(Service, Name, undefined, _) ->
    [{"ID", Service}, {"Name", Service}, {"Tags", [list_to_atom(Name)]}];
  build_registration_body(Service, undefined, Port, TTL) ->
    [{"ID", Service}, {"Name", Service}, {"Port", Port}, {"Check", [{"Notes", ?NOTES}, {"TTL", ttl_string(TTL)}]}];
  build_registration_body(Service, Name, Port, TTL) ->
    [{"ID", Service}, {"Name", Service}, {"Port", Port}, {"Tags", [list_to_atom(Name)]}, {"Check", [{"Notes", ?NOTES}, {"TTL", ttl_string(TTL)}]}].
  
  
  %% @private
  