anchor.diff:  	  nodes=Nodes}.
   
   merge_states(StateA, StateB) ->
  -  PartA = StateA#membership.partitions,
  -  PartB = StateB#membership.partitions,
  -  Config = configuration:get_config(),
  -  Nodes = lists:usort(StateA#membership.nodes ++ StateB#membership.nodes),
  -  Partitions = partitions:map_partitions(PartA, Nodes),
  -  % error_logger:info_msg("Merged nodes ~p and partitions ~p~n", [Nodes, length(Partitions)]),
  -  ?infoFmt("merge states setting node to ~p", [StateA#membership.node]),
  -  #membership{
  -    version=vector_clock:merge(StateA#membership.version, StateB#membership.version),
  -    nodes=Nodes,
  -    node=StateA#membership.node,
  -    partitions=Partitions,
  -    gossip=StateA#membership.gossip
  -  }.
  +  Merged =
  +    case vector_clock:compare(StateA#membership.version, StateB#membership.version) of
  +      less -> % remote state is strictly newer than ours
  +        StateB;
  +      greater -> % remote state is strictly older
  +        StateA;
  +      equal -> % same vector clock
  +        StateA;
  +      concurrent -> % must merge
  +        PartA = StateA#membership.partitions,
  +        PartB = StateB#membership.partitions,
  +        Config = configuration:get_config(),
  +        Nodes = lists:usort(StateA#membership.nodes ++ StateB#membership.nodes),
  +        Partitions = partitions:map_partitions(PartA, Nodes),
  +        #membership{
  +          version=vector_clock:merge(StateA#membership.version, StateB#membership.version),
  +          nodes=Nodes,
  +          node=StateA#membership.node,
  +          partitions=Partitions,
  +          gossip=StateA#membership.gossip
  +        }
  +  end.
   
   % Merges in another state, reloads any storage
   % and sync servers that changed, saves state
  
positive.code: %% @doc Handling cast messages
  %% @end 
  %%--------------------------------------------------------------------
  handle_cast({gossip_with, Server}, State = #membership{nodes = Nodes}) ->
    % share our state with target node - expects a response back, but we don't
    % want to wait for it
    Self = self(),
    GosFun =
      fun() ->
          ?infoFmt("start gossip at ~p~n", [lib_misc:now_float()]),
          {ok, RemoteState} = gen_server:call(Server, {share, State}),
          {ok, ModState} = gen_server:call(Self, {share, RemoteState}),
          ?infoFmt("end gossip at ~p~n", [lib_misc:now_float()])
      end,
    spawn_link(GosFun),
    {noreply, State};
  
negative.code:       fire_gossip(random_node(Nodes1))
    end,
    SleepTime = random:uniform(5000) + 5000,
    receive
      stop -> gossip_paused(Server);
      _Val -> ok
  