anchor.diff:  status_to_atom(<<"running">>) ->
       running;
   status_to_atom(<<"restarting">>) ->
  -    restarting.
  +    restarting;
  +status_to_atom(<<"down">>) ->
  +    down.
   
   %
   % Question: Why isn't the gen_fsm:start_timer/cancel_timer used here?
  
positive.code: handle_event({logging, Level}, StateName, State) ->
      State1 = State#state{logging=Level},
      {next_state, StateName, State1};
  handle_event(_Event, StateName, #state{name=Name}=State) ->
      lager:error("FSM for ~p received unexpected event ~p", [Name, _Event]),
      {next_state, StateName, State}.
  
  handle_sync_event(_Event, _From, StateName, State) ->
      {reply, ignored, StateName, State}.
  
  
  handle_info({'DOWN', _MonitorRef, _Type, Object, _Info}, StateName, State) ->
      Observers = State#state.observers,
      State1 = State#state{observers=lists:delete(Object,Observers)},
      {next_state, StateName, State1};
  handle_info({heartbeat, NodeName, NodeState},
              StateName, #state{logging=Level, heartbeats=HeartBeats, heartbeat_rate=HRate}=State) ->
      nlog(Level, "Heartbeat recieved from ~p Currently ~p ~p", [NodeName, NodeState, HRate]),
      eavg_value(HRate),
      %% Note that we got a heartbeat
      State1 = State#state{heartbeat_rate=eavg_inc(HRate,1)},
  
      case HeartBeats of
          ?POC_HB_THRESHOLD - 1 ->
              State2 = reset_timer(save_status(?SAVE_MODE, NodeState, State1)),
              {next_state, NodeState, State2#state{heartbeats=HeartBeats + 1}};
          ?POC_HB_THRESHOLD ->
              {next_state, StateName, State1};
          _ ->
              {next_state, NodeState, reset_timer(save_status(?SAVE_MODE, NodeState, State1))}
      end;
  handle_info(down, _StateName, State) ->
      {next_state, down, save_status(?SAVE_MODE, down, State#state{heartbeats=0})};
  handle_info({timeout, _Ref, update_avg}, StateName, #state{heartbeat_rate=HRate}=State) ->
      {next_state, StateName, State#state{heartbeat_rate=eavg_tick(HRate)} };
  handle_info(Info, StateName, State) ->
      lager:error("Strange message ~p received in state ~p", [Info, StateName]),
      {next_state, StateName, State}.
  
  
  terminate(_Reason, _StateName, _State) ->
      ok.
  
  code_change(_OldVsn, StateName, State, _Extra) ->
      {ok, StateName, State}.
  
  %% Internal functions
  
  
negative.code: 
  -spec eavg_tick(#eavg{}) -> #eavg{}.
  eavg_tick(#eavg{acc=Acc, avg=Avg, n=N, tick_interval=I}=EAvg) ->
      NAvg = (Avg * (N-1) + Acc)/N,
      TRef = erlang:start_timer(I, self(), update_avg),
      EAvg#eavg{acc=0, avg=NAvg, tref=TRef}.
  