anchor.diff:                                 [ down | Stale ]
                          end
                  end, Nodes),
  -    {reply, Nodes1, State#state{nodes=Nodes}}.
  +    {reply, Nodes1, State}.
   
   
  +handle_cast({heartbeat, Name, Status}, State) ->
  +    Nodes = update_status(Name, Status, State#state.nodes),
  +    {noreply, State#state{nodes=Nodes}};
  +
   handle_cast(Msg, State) ->
  -    ?log_info("Unexpected cast: ~p", [Msg]),
  +    ?log_warning("Unexpected cast: ~p", [Msg]),
       {noreply, State}.
   
   
  
positive.code: %% API
  
  heartbeat(Status) ->
      heartbeat(node(), Status).
  
  heartbeat(Node, Status) ->
      catch global:send(?MODULE, {heartbeat, Node, Status}).
  
  get_nodes() ->
      try gen_server:call({global, ?MODULE}, get_nodes) of
          Nodes -> Nodes
      catch
          _:_ -> dict:new()
      end.
  
  
  %% Internal functions
  
  collect_status(Nodes) ->
      receive
          {heartbeat, Name, Status} ->
              Nodes1 = update_status(Name, Status, Nodes),
              collect_status(Nodes1)
      after 0 ->
              Nodes
      end.
  
  
  update_status(Name, Status, Dict) ->
      Node = [{last_heard, erlang:now()} | Status],
      dict:store(Name, Node, Dict).
  
negative.code:     Nodes = lists:foldl(fun ({Node, Status}, Dict) ->
                                  update_status(Node, Status, Dict)
                          end, NodeDict, Replies),
      ?log_info("Got initial status ~p~n", [Nodes]),
      {noreply, State#state{nodes=Nodes}};
  
  handle_info(Info, State) ->
      ?log_warning("Unexpected message ~p in state",
                   [Info]),
      {noreply, State}.
  
  terminate(_Reason, _State) -> ok.
  