anchor.diff:  %% based on node states of all nodes. The list must not be empty.
   %% @end
   %%--------------------------------------------------------------------
  --spec advices_for_dispatchers(NodeStates :: [#node_state{}]) -> [{node(), #dispatcher_lb_advice{}}].
  -advices_for_dispatchers(NodeStates) ->
  +-spec advices_for_dispatchers(NodeStates :: [#node_state{}], LBState :: #load_balancing_state{}) ->
  +    [{node(), #dispatcher_lb_advice{}}].
  +advices_for_dispatchers(NodeStates, #load_balancing_state{expected_extra_load = ExtraLoads} = LBState) ->
       Nodes = [NodeState#node_state.node || NodeState <- NodeStates],
  -    LoadsForDisp = [load_for_dispatcher(NodeState) || NodeState <- NodeStates],
  +    LoadsForDisp = lists:foreach(
  +        fun(NodeState) ->
  +            L = load_for_dispatcher(NodeState),
  +            ExtraLoad = proplists:get_value(NodeState#node_state.node, ExtraLoads, 0.0),
  +            L * (1.0 - ExtraLoad)
  +        end, NodeStates),
       AvgLoadForDisp = average(LoadsForDisp),
       MinLoadForDisp = lists:min(LoadsForDisp),
       LoadsAndNodes = lists:zip(LoadsForDisp, Nodes),
  
positive.code:     LoadsForDNS = [load_for_dns(NodeState) || NodeState <- NodeStates],
      MinLoadForDNS = lists:min(LoadsForDNS),
      LoadsAndNodes = lists:zip(LoadsForDNS, NodesAndIPs),
      NotOverloaded = lists:filter(
          fun({Load, _}) ->
              not overloaded_for_dns(Load, MinLoadForDNS)
          end, LoadsAndNodes),
  
      % TODO testy
      lists:foreach(
          fun({_, {Node, _}}) ->
              io:format("[DNS] excluding ~p~n", [Node])
          end, LoadsAndNodes -- NotOverloaded),
  
      % Calculate how often should given nodes appear in the first row in DNS
      % responses. The bigger the load, the less often should the node appear.
      NodesAndFrequency = [{NodeIP, MinLoadForDNS / Load} || {Load, {_, NodeIP}} <- NotOverloaded],
      FrequencySum = lists:foldl(fun({_, Freq}, Acc) -> Acc + Freq end, 0.0, NodesAndFrequency),
      NormalizedNodesAndFrequency = [{NodeIP, Freq / FrequencySum} || {NodeIP, Freq} <- NodesAndFrequency],
      NodeChoices = [NodeIP || {NodeIP, _} <- NormalizedNodesAndFrequency],
  
negative.code:     all_nodes = [] :: [node()]
  }).
  
  
  % This records holds a state that should be passed between each calculation
  % of load balancing advices. It contains data from previous calculations
  % that is needed in next ones.
  -record(load_balancing_state, {
      % Contains information how much extra load is expected on given node
      % in current load balancing interval. Extra load is estimated load
      % caused by delegation.
      expected_extra_load = [] :: [{Node :: node(), ExtraLoad :: float()}]
  }).
  
  -type dns_lb_advice() :: #dns_lb_advice{}.
  -type dispatcher_lb_advice() :: #dispatcher_lb_advice{}.
  
  