anchor.diff:  
   lock_keys(error, _, _) ->
       error;
  -lock_keys(ok, [], _Session) ->
  -    ok;
  -lock_keys(ok, [{_Id, Operation}|Remainder], Session) ->
  +lock_keys(ok, [], _TransactionId) ->
  +    ok;
  +lock_keys(ok, [{_Id, Operation}|Remainder], TransactionId) ->
       Key = operation_key(Operation),
       Current = get(Key),
  -    case key_meta:is_locked(Current, Session) of
  +    case key_meta:is_locked(Current, TransactionId) of
           true -> error;
           false ->
  -            put(Key, key_meta:lock(Current, Session)),
  -            case lock_keys(ok, Remainder, Session) of
  +            put(Key, key_meta:lock(Current, TransactionId)),
  +            case lock_keys(ok, Remainder, TransactionId) of
                   ok -> ok;
                   error -> put(Key, Current), error
               end
       end.
   
  -handle_rollback_transaction(#state{transactions=Transactions, store=Store}=State, Session) ->
  -    Transaction = dict:fetch(Session, Transactions),
  +handle_rollback_transaction(#state{transactions=Transactions, store=Store}=State, TransactionId) ->
  +    Transaction = dict:fetch(TransactionId, Transactions),
       unlock_transaction(Store, Transaction),
       remove_watches(Transaction#transaction.watches),
  -    State#state{transactions=dict:erase(Session, Transactions)}.
  -
  -handle_commit_transaction(#state{transactions=Transactions, store=Store}=State, Session) ->
  -    Transaction = dict:fetch(Session, Transactions),
  -    apply_transaction(Store, Transaction, Session),
  -    remove_watches(Transaction#transaction.watches),
  -    State#state{transactions=dict:erase(Session, Transactions)}.
  -
  -apply_transaction(Store, #transaction{operations=Operations}=Transaction, Session) ->
  +    State#state{transactions=dict:erase(TransactionId, Transactions)}.
  +
  +handle_commit_transaction(#state{transactions=Transactions, store=Store}=State, TransactionId) ->
  +    Transaction = dict:fetch(TransactionId, Transactions),
  +    apply_transaction(Store, Transaction, TransactionId),
  +    State.
  +
  +apply_transaction(Store, #transaction{operations=Operations}=Transaction, TransactionId) ->
       Pipe = redis_store:pipeline(Store),
       Pipe2 = lists:foldr(fun({_Order, O}, P) -> handle_batch_operation(P, O) end, Pipe, Operations),
  -    redis_store:commit(Session, Pipe2),
  +    redis_store:commit(#transaction_operation{txn_id=TransactionId}, Pipe2),
       unlock_transaction(Store, Transaction).
   
   unlock_transaction(Store, #transaction{deferred=Deferred, locked=false}=Transaction) ->
  
positive.code:     put(Key, key_meta:unlock(get(Key))),
      unlock_keys(Remainder).
  
  handle_store_result(State, Session, Result) ->
      Session ! {self(), Result},
      State.
  
  
negative.code:     redis_store:delete(Store, Key).
  
  handle_operation(Store, Session, #get{key=Key}, _Current) ->
      redis_store:get(#single_operation{session=Session}, Store, Key);
  handle_operation(Store, Session, #set{key=Key, value=Value}, Current) ->
      update_meta(Key, Current),
      redis_store:set(#single_operation{session=Session}, Store, Key, Value);
  handle_operation(Store, Session, #delete{key=Key}, Current) ->
      delete_meta(Key, Current),
      redis_store:delete(#single_operation{session=Session}, Store, Key).
  
  add_operation(error, Session, Operation) ->
      add_operation({ok, #transaction{session=Session}}, Session, Operation);
  add_operation({ok, #transaction{}=Transaction}, Session, Operation) ->
      Session = Transaction#transaction.session,
      Transaction#transaction{operations=[Operation|Transaction#transaction.operations]}.
  
  handle_transact(#state{transactions=Transactions}=State, #transact{txn_id=TransactionId, session=Session, operation_id=Id, operation=Operation}) ->
      Session ! {self(), stored},
      NewTransaction = add_operation(dict:find(TransactionId, Transactions), Session, {Id, Operation}),
      State#state{transactions=dict:store(TransactionId, NewTransaction, Transactions)}.
  
  handle_watch(#state{transactions=Transactions}=State, #watch{txn_id=TransactionId, session=Session, key=Key}) ->
      Session ! {self(), ok},
      NewTransaction = add_watch(dict:find(TransactionId, Transactions), Session, Key),
      State#state{transactions=dict:store(TransactionId, NewTransaction, Transactions)}.
  
  add_watch(error, Session, Key) ->
      add_watch({ok, #transaction{session=Session}}, Session, Key);
  add_watch({ok, #transaction{watches=Watches}=Transaction}, Session, Key) ->
      Session = Transaction#transaction.session,
      Current = get(Key),
      put(Key, key_meta:watch(Current)),
      Transaction#transaction{watches=[{Key, key_meta:version(Current)}|Watches]}.
  
  handle_unwatch(#state{transactions=Transactions}=State, #unwatch{txn_id=TransactionId, session=Session}) ->
      Session ! {self(), ok},
      State#state{transactions=remove_watch(Transactions, TransactionId, dict:find(TransactionId, Transactions))}.
  
  remove_watch(Transactions, _TransactionId, error) ->
      Transactions;
  remove_watch(Transactions, TransactionId, {ok, Transaction}) ->
      remove_watches(Transaction#transaction.watches),
      dict:store(TransactionId, Transaction#transaction{watches=[]}, Transactions).
  
  remove_watches([]) ->
      ok;
  