anchor.diff:  -record(state, {id, statsfun, monitors}).
   
   -define(CM_POOL, ?MODULE).
  -
  --define(LOG(Level, Format, Args, Client),
  -            lager:Level("CM(~s): " ++ Format, [Client#mqtt_client.client_id|Args])).
   
   %%%=============================================================================
   %%% API
  
positive.code:         Pid ->
              ets:delete(mqtt_client, ClientId),
              {noreply, setstats(State)};
          undefined ->
              {noreply, State}
      end;
  
  
negative.code: handle_cast({register, Client = #mqtt_client{client_id  = ClientId,
                                               client_pid = Pid}}, State) ->
      case lookup_proc(ClientId) of
          Pid ->
              {noreply, State};
          _ ->
              ets:insert(mqtt_client, Client),
              {noreply, setstats(monitor_client(ClientId, Pid, State))}
  	end;
  