anchor.diff:     lists:map(fun hash_xml_body/1, ChildNodes)}.
   
   %@doc Performs base64-encoding on tuple's second element
  +hash_xml_attribute({"id", _} = Attr) -> Attr;
   hash_xml_attribute({"to", _} = Attr) -> Attr;
   hash_xml_attribute({"from", _} = Attr) -> Attr;
   hash_xml_attribute({"noack", _} = Attr) -> Attr;
  
positive.code: ucfirst([]) -> [];
  ucfirst([First|Rest]) -> string:to_upper(lists:nth(1, io_lib:format("~c", [First]))) ++ Rest.
  
  %@doc Mongo driver invalidates the connection on every error,
  mongo_reconnect(State) ->
    mongo:disconnect(proplists:get_value(mongo, State)),
  
negative.code: prepare_event_command(Event, Type, Host) -> proplists:delete(Type, prepare_event_command(Event, Type, "", Host)).
  prepare_event_command(Event, Type, Value, Host) ->
    [{"command", "reportEvent" ++ ucfirst(Type)},
     {"component", "ejabberd." ++ Host},
     {"event", Event},
     {Type, Value}].
  
  wrap_event_command(To, Command) ->
    {xmlelement, "message", [{"id", erlang:integer_to_list(timestamp())},
                             {"from", ?JID},
                             {"to", To},
                             {"noack", "1"}],
                            [{xmlelement, "body", [], [
                                                        {xmlelement, "info", Command, []}
                                                      ]}
                            ]}.
  
  %@doc Sends a reportEvent command to the Monitor
  report_event(Host, Event) ->
    To = gen_mod:get_module_opt(Host, ?MODULE, monitor_jid, "monitor@localhost"),
    XmlBody = wrap_event_command(To, prepare_event_command(Event, Host)),
    route_to_copilot_component(To, XmlBody),
    ok.
  
  %@doc Sends a reportEvent{Type} command to the Monitor
  report_event(Host, Event, Value, Type) ->
    To = gen_mod:get_module_opt(Host, ?MODULE, monitor_jid, "monitor@localhost"),
    XmlBody = wrap_event_command(To, prepare_event_command(Event, Value, Type, Host)),
    route_to_copilot_component(To, XmlBody),
    ok.
  