anchor.diff:  
   %%%% VNode methods ----------------------------------------------------------+
   
  --spec process_queue(#state{}) -> #state{}.
  -process_queue(State=#state{queue=Queue}) ->
  +%% Check the content of each queue, try to apply as many elements as possible.
  +%% If any element was successfully pushed from any queue, repeat the process.
  +-spec process_all_queues(#state{}) -> #state{}.
  +process_all_queues(State = #state{queues = Queues}) ->
  +  DCIDs = dict:fetch_keys(Queues),
  +  {NewState, NumUpdated} = lists:foldl(fun process_queue/2, {State, 0}, DCIDs),
  +  case NumUpdated of
  +    0 -> NewState;
  +    _ -> process_all_queues(NewState)
  +  end.
  +
  +%% Tries to process as many elements in the queue as possible.
  +%% Returns the new state and the number of processed elements
  +process_queue(DCID, {State, Acc}) ->
  +  Queue = dict:fetch(DCID, State#state.queues),
     case queue:peek(Queue) of
  -    empty -> State;
  +    empty -> {State, Acc};
       {value, Txn} ->
         {NewState, Success} = try_store(State, Txn),
         case Success of
  -        false -> NewState;
  -        true -> process_queue(NewState#state{queue = queue:drop(Queue)})
  -      end
  +        false -> {NewState, Acc};
  +        true -> process_queue(DCID, {pop_txn(NewState, DCID), Acc + 1}) %% remove the just-applied txn and retry
  +    end
     end.
   
   %% Store the heartbeat message.
   %% This is not a true transaction, so its dependencies are always satisfied.
   -spec try_store(#state{}, #interdc_txn{}) -> {#state{}, boolean}.
   try_store(State, #interdc_txn{dcid = DCID, timestamp = Timestamp, operations = []}) ->
  -  {update_the_clock(State, DCID, Timestamp), true};
  +  {update_clock(State, DCID, Timestamp), true};
   
   %% Store the normal transaction
   try_store(State, Txn=#interdc_txn{dcid = DCID, partition = Partition, timestamp = Timestamp, operations = Ops}) ->
  
positive.code: -spec init([partition_id()]) -> {ok, #state{}}.
  init([Partition]) ->
    {ok, StableSnapshot} = vectorclock:get_stable_snapshot(),
    {ok, #state{partition = Partition, queue = queue:new(), vectorclock = StableSnapshot}}.
  
  start_vnode(I) -> riak_core_vnode_master:get_vnode_pid(I, ?MODULE).
  
  
negative.code: %% VNode state
  -record(state, {
    partition :: partition_id(),
    queues :: dict(), %% DCID -> queue()
    vectorclock :: vectorclock()
  }).
  
  