anchor.diff:  %%--------------------------------------------------------------------
   %% @doc
   %% Get nodes that are responsible for the data labeled with given term.
  -%% Returns two lists: alvie and broken nodes.
  +%% Returns three lists: alvie connected nodes, other alive nodes and broken nodes.
  +%% Sum of lists' length is equal to requested nodes' count.
   %% @end
   %%--------------------------------------------------------------------
   -spec get_nodes(term(), non_neg_integer() | all) ->
       {KeyConnectedNodes :: [node()], OtherRequestedNodes :: [node()], BrokenNodes :: [node()]}.
  -get_nodes(Label, RequestedNodesNum) ->
  +get_nodes(Label, RequestedNodesNum0) ->
       case get_chash_ring() of
           undefined ->
               error(chash_ring_not_initialized);
           #ring{type = single_node, chash = Node} ->
  -            {[Node], []};
  -        #ring{type = multi_node, chash = CHash, key_connected_nodes = KeyConnectedNodesNum} ->
  -            Index = chash:key_of(Label),
  -            Nodes = case RequestedNodesNum of
  -                all -> get_all_nodes();
  -                _ -> lists:map(fun({_, Node}) -> Node end,
  -                    chash:successors(Index, CHash, max(KeyConnectedNodesNum, RequestedNodesNum)))
  -            end,
  +            {[Node], [], []};
  +        #ring{type = multi_node, chash = CHash, key_connected_nodes = KeyConnectedNodesNum} = Ring ->
  +            Index = chash:key_of(Label),
  +            RequestedNodesNum = get_requested_nodes_num(RequestedNodesNum0, Ring),
  +            Nodes = lists:map(fun({_, Node}) -> Node end,
  +                    chash:successors(Index, CHash, max(KeyConnectedNodesNum, RequestedNodesNum))),
               {KeyConnectedNodes, OtherRequestedNodes} = lists:split(min(KeyConnectedNodesNum, length(Nodes)), Nodes),
               {KeyConnectedNodes, OtherRequestedNodes, []};
           #ring{type = broken, chash = CHash, broken_nodes = BrokenNodes,
  -            key_connected_nodes = KeyConnectedNodesNum} ->
  -            Index = chash:key_of(Label),
  -            Nodes = case RequestedNodesNum of
  -                all -> get_all_nodes();
  -                _ -> chash:successors(Index, CHash, max(KeyConnectedNodesNum, RequestedNodesNum))
  -            end,
  +            key_connected_nodes = KeyConnectedNodesNum}  = Ring ->
  +            Index = chash:key_of(Label),
  +            RequestedNodesNum = get_requested_nodes_num(RequestedNodesNum0, Ring),
  +            Nodes = chash:successors(Index, CHash, max(KeyConnectedNodesNum, RequestedNodesNum)),
               {KeyConnectedNodes, OtherRequestedNodes} = lists:split(min(KeyConnectedNodesNum, length(Nodes)), Nodes),
               {AliveKeyConnectedNodes, BrokenKeyConnectedNodes} = filter_nodes(KeyConnectedNodes, BrokenNodes),
               {AliveOtherRequestedNodes, BrokenOtherRequestedNodes} = filter_nodes(OtherRequestedNodes, BrokenNodes),
  
positive.code:     {Index, _} = lists:nth(N, chash:nodes(CHash)),
      Index.
  
  -spec filter_nodes(ResponsibleNodes :: [node() | {integer(), node()}], AllBrokenNodes :: [node()]) ->
      {GoodNodes :: [node()], BrokenNodes :: [node()]}.
  filter_nodes([], _BrokenNodes) ->
      {[], []};
  filter_nodes([{_, Node} | Nodes], BrokenNodes) ->
      filter_nodes(Node, Nodes, BrokenNodes) ;
  filter_nodes([Node | Nodes], BrokenNodes) ->
      filter_nodes(Node, Nodes, BrokenNodes).
  
  -spec filter_nodes(CheckedNode :: node(), ResponsibleNodes :: [node() | {integer(), node()}],
      AllBrokenNodes :: [node()]) -> {GoodNodes :: [node()], BrokenNodes :: [node()]}.
  filter_nodes(Node, Nodes, BrokenNodes) ->
      {AliveNodesAns, BrokenNodesAns} = filter_nodes(Nodes, BrokenNodes),
      case lists:member(Node, BrokenNodes) of
          true ->
              {AliveNodesAns, [Node | BrokenNodesAns]};
          _ ->
              {[Node | AliveNodesAns], BrokenNodesAns}
      end.
negative.code: 
  %%--------------------------------------------------------------------
  %% @doc
  %% Gets information about number of nodes connected with key.
  %% @end
  %%--------------------------------------------------------------------
  -spec get_key_connected_nodes() -> pos_integer().
  get_key_connected_nodes() ->
      ctool:get_env(key_connected_nodes, 1).
  
  %%--------------------------------------------------------------------
  %% @doc
  %% Get node that is responsible for the data labeled with given term.
  %% Throws error if node is broken.
  %% @end
  