anchor.diff:      end,
       State;
   
  -on({gather_stats_response, Round, DataL} = _Msg, State) when Round =:= State#state.round->
  -    ?TRACE1(_Msg, State),
  -    lists:foldl(
  -      fun(Data, A) ->
  -              case Data of
  -                  {?MODULE, "read_read", PerfRR} ->
  -                      DB = A#state.perf_rr,
  -                      T = rrd:get_current_time(DB),
  -                      A#state{perf_rr = rrd:add_with(T, PerfRR, DB, fun timing_update_fun/3)};
  -                  {dht_node, "lookup_hops", PerfLH} ->
  -                      DB = A#state.perf_lh,
  -                      T = rrd:get_current_time(DB),
  -                      A#state{perf_lh = rrd:add_with(T, PerfLH, DB, fun timing_update_fun/3)}
  -              end
  -      end, State, DataL);
  +on({gather_stats_response, Round, DataL} = _Msg, {AllNodes, Leader} = _State)
  +  when Round =:= Leader#state.round->
  +    ?TRACE1(_Msg, _State),
  +    Leader1 =
  +        lists:foldl(
  +          fun(Data, A) ->
  +                  case Data of
  +                      {?MODULE, "read_read", PerfRR} ->
  +                          DB = A#state.perf_rr,
  +                          T = rrd:get_current_time(DB),
  +                          A#state{perf_rr = rrd:add_with(T, PerfRR, DB, fun timing_update_fun/3)};
  +                      {dht_node, "lookup_hops", PerfLH} ->
  +                          DB = A#state.perf_lh,
  +                          T = rrd:get_current_time(DB),
  +                          A#state{perf_lh = rrd:add_with(T, PerfLH, DB, fun timing_update_fun/3)}
  +                  end
  +          end, Leader, DataL),
  +    {AllNodes, Leader1};
   on({gather_stats_response, _Round, _Data} = _Msg, State) ->
       ?TRACE1(_Msg, State),
       State;
   
  -on({report_value, OtherState} = _Msg, State) when OtherState#state.round > State#state.round ->
  -    ?TRACE1(_Msg, State),
  -    integrate_values(OtherState, State);
  +on({report_value, OtherState} = _Msg, {AllNodes, Leader} = _State)
  +  when OtherState#state.round > AllNodes#state.round ->
  +    ?TRACE1(_Msg, _State),
  +    AllNodes1 = integrate_values(OtherState, AllNodes),
  +    {AllNodes1, Leader};
   
   on({report_value, _OtherState} = _Msg, State) ->
       ?TRACE1(_Msg, State),
  +    State;
  +
  +on({web_debug_info, Requestor} = _Msg, {AllNodes, Leader} = State) ->
  +    ?TRACE1(_Msg, _State),
  +    KeyValueList =
  +        [{"all nodes", lists:flatten(io_lib:format("~p", [AllNodes]))},
  +         {"leader",    lists:flatten(io_lib:format("~p", [Leader]))}],
  +    comm:send_local(Requestor, {web_debug_info_reply, KeyValueList}),
       State.
   
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
positive.code:     {Sum + NewSum, Sum2 + NewSum2, Count + NewCount,
       erlang:min(Min, NewMin), erlang:max(Max, NewMax), NewHist2}.
  
  -spec check_timeslots(state()) -> state().
  check_timeslots(State = #state{perf_rr = PerfRR, perf_lh = PerfLH}) ->
      State#state{perf_rr = rrd:check_timeslot_now(PerfRR),
                  perf_lh = rrd:check_timeslot_now(PerfLH)}.
  
  -spec broadcast_values(OldState::state(), NewState::state()) -> ok.
  broadcast_values(OldState, NewState) ->
      % broadcast the latest value only if a new time slot was started
      OldPerfRR = OldState#state.perf_rr,
  
negative.code:     msg_delay:send_local(FirstDelay, self(), {bench}),
      msg_delay:send_local(get_gather_interval(), self(), {propagate}),
      Now = os:timestamp(),
      State = #state{perf_rr = rrd:create(get_gather_interval() * 1000000, 60, {timing, us}, Now),
                     perf_lh = rrd:create(get_gather_interval() * 1000000, 60, {timing, count}, Now)},
      {State, State}.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % Miscellaneous
  