anchor.diff:    AgentData = erlang:list_to_tuple(list:flatmap(fun erlang:tuple_to_list/1, parse_component_jid(User))),
     NewData = {disconnected_at, bson:timenow(),
                agent_data, AgentData},
  -  % Updates the active flag and appends new data
  -  bson:append(bson:update(active, false, Doc), NewData);
  -doc_close_connection({failure, _}, _, _, _) ->
  +  bson:append(bson:update(connected, false, Doc), NewData);
  +doc_close_connection({failure, Failure}, _, _) ->
     % Silently fails
  +  ?DEBUG("MongoDB failed in doc_close_connection ~p", [Failure]),
     failure.
   
   %@doc Sends an message as mod_copilot@localhost and performs base64-encoding of the attributes
  
positive.code:   Opts = proplists:get_value(opts, State),
    Host = case proplists:get_value(mongodb, Opts) of
      undefined -> {localhost, 27017};
      Value -> Value;
    end,
    {ok, NewConn} = mongo:connect(Host),
    proplists:delete(conn, State) ++ [{conn, NewConn}].
  
negative.code:   lists:zip([component, version, cores, jobs, uuid, ukn], strings:tokens(User, "_")).
  
  %@doc Creates a MonoDB document describing the connection
  doc_create_connection({User, Host, Resource}, IPAddress) ->
    GeoData = lookup_ip(IPAddress),
    Lng = proplists:get_value(longitude, GeoData),
    Lat = proplists:get_value(latitude, GeoData),
  
    {jid, User ++ "@" ++ Host ++ "/" ++ Resource,
     loc, [Lng, Lat],
     connected_at, bson:timenow(),
     connected, true}.
  
  %@doc Marks connection as closed and appends data from agent's JID
  doc_close_connection({ok, {}}, JID, IPAddress) ->
  