anchor.diff:      %% crashes the gen_server by re-registering that stat.
       #state{repair_mon={Pid, _Mon}} = State,
       Pid ! {re_register_stat, Arg},
  +    {noreply, State};
  +handle_cast({monitor, Type, Pid}, State) ->
  +    case proplists:get_value(Type, State#state.monitors) of
  +        Monitor when is_pid(Monitor) ->
  +            Monitor ! {add_pid, Pid};
  +        _ -> lager:error("Couldn't find process for ~p to add monitor", [Type])
  +    end,
       {noreply, State};
   handle_cast(stop, State) ->
       {stop, normal, State};
  
positive.code: 
  init([]) ->
      register_stats(),
      State = #state{monitors = [spawn_link(?MODULE, monitor_loop, [index]),
                                 spawn_link(?MODULE, monitor_loop, [list])],
                     repair_mon = spawn_monitor(fun() -> stat_repair_loop() end)},
      {ok, State}.
  
  handle_call({register, Name, Type}, _From, State) ->
      Rep = do_register_stat(Name, Type),
      {reply, Rep, State};
  handle_call({get_monitor, Type}, _From, State) ->
      Monitors = State#state.monitors,
      [Monitor] = lists:filter(fun(Mon) ->
                                       Mon ! {get_type, self()},
                                       receive
                                           T when is_atom(T),
                                                  T == Type ->
                                               true;
                                           _ -> false
                                       after
                                           1000 -> false
                                       end
                               end,
                               Monitors),
      {reply, Monitor, State}.
  
  handle_cast({re_register_stat, Arg}, State) ->
      %% To avoid massive message queues
  
negative.code: %% private
  
  add_monitor(Type, Pid) ->
      gen_server:cast(?SERVER, {monitor, Type, Pid}).
  
  monitor_loop(Type) ->
      receive
  