anchor.diff:           random_map/3,
            vbucket_movements/2,
            run_rebalance_counts_experiment/0,
  -         find_matching_past_maps/4, score_maps/3, best_map/2]).
  +         find_matching_past_maps/4,
  +         find_matching_past_maps/5,
  +         score_maps/3, best_map/2]).
   
   
   -export([counts/1]). % for testing
  
positive.code:     TagRenaming ++ build_tag_renaming(Rest).
  
  matching_renamings_same_vbuckets_count(KeepNodesSet, CurrentTags,
                                         CandidateMap, CandidateTags) ->
      CandidateNodesSet = map_nodes_set(CandidateMap),
      case sets:size(CandidateNodesSet) =:= sets:size(KeepNodesSet) of
          false ->
              [];
          true ->
              CurrentNotCommon = sets:subtract(KeepNodesSet, CandidateNodesSet),
              case sets:size(CurrentNotCommon) of
                  0 ->
                      case lists:sort(CandidateTags) == lists:sort(CurrentTags) of
                          true ->
                              [CandidateMap];
                          false ->
                              matching_tag_renaming(CandidateMap,
                                                    CandidateTags, CurrentTags)
                      end;
                  1 ->
                      [NewNode] = sets:to_list(CurrentNotCommon),
                      [OldNode] = sets:to_list(sets:subtract(CandidateNodesSet, KeepNodesSet)),
  
                      rewrite_map(CandidateMap, CandidateTags, CurrentTags,
                                  [{OldNode, NewNode}]);
                  2 ->
                      [NewNodeA, NewNodeB] = sets:to_list(CurrentNotCommon),
                      [OldNodeA, OldNodeB] = sets:to_list(sets:subtract(CandidateNodesSet, KeepNodesSet)),
  
  
negative.code:                 end, Acc, Chain)
        end, sets:new(), Map).
  
  matching_renamings(KeepNodesSet, CurrentMap, CandidateMap, Trivial) ->
      matching_renamings_with_tags(KeepNodesSet,
                                   {CurrentMap, undefined},
                                   {CandidateMap, undefined}, Trivial).
  
  matching_renamings_with_tags(KeepNodesSet, {CurrentMap, CurrentTags0},
                               {CandidateMap, CandidateTags0}, Trivial) ->
      CurrentTags = case CurrentTags0 of
                        undefined ->
                            [];
  