anchor.diff:  operation_key(#delete{key=Key}) ->
       Key.
   
  -handle_lock_transaction(#state{transactions=Transactions, store=Store}=State, Session) ->
  -    Transaction = dict:fetch(Session, Transactions),
  +handle_lock_transaction(#state{transactions=Transactions, store=Store}=State, TransactionId) ->
  +    Transaction = dict:fetch(TransactionId, Transactions),
       WatchStatus = check_watches(Transaction#transaction.watches),
  -    LockStatus = lock_keys(WatchStatus, Transaction#transaction.operations, Session),
  -    Session ! #transaction_locked{bucket=self(), status=LockStatus},
  +    LockStatus = lock_keys(WatchStatus, Transaction#transaction.operations, TransactionId),
  +    Transaction#transaction.session ! #transaction_locked{bucket=self(), status=LockStatus},
       NewTransaction = case LockStatus of
           ok ->
               Transaction#transaction{locked=true};
           error ->
               unlock_transaction(Store, Transaction#transaction{locked=false})
       end,
  -    State#state{transactions=dict:store(Session, NewTransaction, State#state.transactions)}.
  +    State#state{transactions=dict:store(TransactionId, NewTransaction, State#state.transactions)}.
   
   check_watches([]) ->
       ok;
  
positive.code:     put(Key, key_meta:unlock(get(Key))),
      unlock_keys(Remainder).
  
  handle_store_result(State, Session, Result) ->
      Session ! {self(), Result},
      State.
  
  
negative.code: 
  lock_keys(error, _, _) ->
      error;
  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, TransactionId) of
          true -> error;
          false ->
              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, TransactionId) ->
      Transaction = dict:fetch(TransactionId, Transactions),
      unlock_transaction(Store, Transaction),
      remove_watches(Transaction#transaction.watches),
      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(#transaction_operation{txn_id=TransactionId}, Pipe2),
      unlock_transaction(Store, Transaction).
  
  unlock_transaction(Store, #transaction{deferred=Deferred, locked=false}=Transaction) ->
  