anchor.diff:  %% beginning of a sorted list consisting of counts of vbuckets *at
   %% this turn for this master* followed by the node name. Also returns
   %% the remainder of the list to make it easy to update the count.
  -best_node([{C, Node} = CN | Rest], Turn, Counts) ->
  -    Total = dict:fetch({total, Node, Turn}, Counts),
  -    case Rest of
  -        [{C1, _}|_] when C1 == C->
  -            {Total1, CN1, Rest1} = best_node(Rest, Turn, Counts),
  -            if Total =< Total1 ->
  -                    {Total, CN, Rest};
  -               true ->
  -                    {Total1, CN1, [CN|Rest1]}
  -            end;
  -        _ ->
  -            {Total, CN, Rest}
  -    end.
  +best_node(NodeCounts, Turn, Counts, Blacklist) ->
  +    NodeCounts1 = [{Count, dict:fetch({total, Node, Turn}, Counts), Node}
  +                   || {Count, Node} <- NodeCounts,
  +                      not lists:member(Node, Blacklist)],
  +    {Count, _, Node} = lists:min(NodeCounts1),
  +    {Count, Node}.
   
   
   %% @private
  
positive.code: chains1(_, 0, _) ->
      [];
  chains1(Counts, NumVBuckets, NumCopies) ->
      {Chain, Counts1} = chains2(Counts, undefined, 1, NumCopies),
      [Chain | chains1(Counts1, NumVBuckets - 1, NumCopies)].
  
  
  chains2(Counts, PrevNode, Turn, Turns) when Turn =< Turns ->
      Key = {PrevNode, Turn},
      %% The first node in the list for this master and turn is the node
      %% with the lowest count. We keep the list sorted by count.
      {Total, {Count, Node}, Rest} =
          best_node(dict:fetch({PrevNode, Turn}, Counts), Turn, Counts),
      Counts1 = dict:store({total, Node, Turn}, Total+1, Counts),
      Counts2 = dict:store(Key, sorted_insert({Count+1, Node}, Rest), Counts1),
      {Chain, Counts3} = chains2(Counts2, Node, Turn+1, Turns),
      {[Node|Chain], Counts3};
  chains2(Counts, _, _, _)  ->
      {[], Counts}.
  
  
  %% @private
  
negative.code: balance_test_() ->
      MapSizes = [1,2,1024,4096],
      NodeNums = [1,2,3,4,5,10,100],
      CopySizes = [1,2,3],
      SlaveNums = [1,2,10],
      {inparallel,
       [balance_test_gen(MapSize, CopySize, NumNodes, NumSlaves)
  