anchor.diff:      comm:send(Pid, {get_takeovers_response, Takeovers}),
       State.
   
  --spec compare_and_fix_rm_with_leases(state()) -> state().
  -compare_and_fix_rm_with_leases(State) ->
  +-spec compare_and_fix_rm_with_leases(state(), intervals:interval(), intervals:interval()) 
  +                                     -> state().
  +compare_and_fix_rm_with_leases(State, OldRange, NewRange) ->
       % @todo we call receive in an on-handler ?!?
       comm:send_local(pid_groups:get_my(dht_node), {get_state, comm:this(), [lease_list, my_range]}),
       {LeaseList, MyRange} = receive
  
positive.code:             State
      end;
  
  on({merge_after_leave, _NewLease, _OldLease, Result}, State) ->
      ?TRACE("merge after finish done: ~w", [Result]),
      State;
  
  on({get_node_for_new_neighbor, {get_state_response, Node}}, State) ->
  
negative.code:             % we lost our active lease; we do not participate in the ring anymore
              State;
          false ->
              case intervals:is_subset(OldRange, NewRange) of
                  true -> 
                      % NewRange > OldRange
                      % my range became larger -> do takeover
                      prepare_takeover(State, MyRange, ActiveRange);
                  false ->
                      case intervals:is_subset(NewRange, OldRange) of
                          true -> 
                              % OldRange > NewRange
                              % my range became smaller -> ignore
                              State;
                          false ->
                              State
                      end
              end
      end.
  
  prepare_takeover(State, MyRange, ActiveRange) ->
      MissingRange = intervals:minus(MyRange, ActiveRange),
      case intervals:is_non_empty(MissingRange) 
          andalso
          intervals:is_left_of(MissingRange, ActiveRange) of
          false ->
              State;
          true ->
              %% log:log("missing range:~n missing=~p~n active=~p~n my_range=~p", 
              %%         [MissingRange, ActiveRange, MyRange]),
              %% log:log("missing range: ~w", [MissingRange]),
              LeaseId = l_on_cseq:id(MissingRange),
              Pid = comm:reply_as(self(), 3, {read_after_rm_change, MissingRange, '_'}),
              l_on_cseq:read(LeaseId, Pid),
              State
      end.
  
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %
  