anchor.diff:          error ->
               State;
           {ok, MyCaps} ->
  -            N1 = reformat_capabilities(Registered, Capabilities),
  -            N2 = intersect_capabilities(N1),
  -            N3 = order_by_preference(MyCaps, N2),
  -            N4 = override_capabilities(N3, Override),
  -            N5 = [{Cap, hd(Common)} || {Cap, Common} <- N4],
  -            State#state{negotiated=N5}
  +            N = preferred_modes(MyCaps, Capabilities, Registered, Override),
  +            State#state{negotiated=N}
       end.
   
   renegotiate_capabilities(State=#state{supported=[]}) ->
  
positive.code:             {true, Ring2}
      end.
  
  %% Given the current view of each node's supported capabilities, determine
  %% the most preferred mode for each capability that is supported by all nodes
  %% in the cluster.
  
negative.code:         _ ->
              add_supported_to_ring(node(), Supported, Ring)
      end.
  
  %% @doc Make a capbility from
  -spec make_capability(capability(), [mode()], mode(), term())
                       -> {capability(), #capability{}}.
  make_capability(Capability, Supported, Default, Legacy) ->
      {Capability, capability_info(Supported, Default, Legacy)}.
  
  %%%===================================================================
  %%% gen_server callbacks
  