anchor.diff:  
   %% @doc after receiving all prepare_times, send the commit message to all
   %%       updated partitions, and go to the "receive_committed" state.
  -committing(commit, Sender, SD0=#state{transaction = Transaction,
  -                                      updated_partitions=Updated_partitions,
  -                                      commit_time=Commit_time}) ->
  -    NumToAck=length(Updated_partitions),
  +committing(commit, Sender, SD0=#state{transaction=Transaction,
  +                                      updated_partitions=UpdatedPartitions,
  +                                      commit_time=CommitTime}) ->
  +    NumToAck = length(UpdatedPartitions),
       case NumToAck of
           0 ->
  -            {next_state, reply_to_client,
  -             SD0#state{state=committed, from=Sender},0};
  +            {next_state, reply_to_client, SD0#state{state=committed, from=Sender}, 0};
           _ ->
  -            clocksi_vnode:commit(Updated_partitions, Transaction, Commit_time),
  -            {next_state, receive_committed,
  -             SD0#state{num_to_ack=NumToAck, from=Sender, state=committing}}
  -    end.
  -
  +            clocksi_vnode:commit(UpdatedPartitions, Transaction, CommitTime),
  +            {next_state, receive_committed, SD0#state{num_to_ack=NumToAck, from=Sender, state=committing}}
  +    end.
   
   %% @doc the fsm waits for acks indicating that each partition has successfully
   %%	committed the tx and finishes operation.
   %%      Should we retry sending the committed message if we don't receive a
   %%      reply from every partition?
   %%      What delivery guarantees does sending messages provide?
  -receive_committed(committed, S0=#state{num_to_ack= NumToAck}) ->
  +receive_committed(committed, S0=#state{num_to_ack=NumToAck}) ->
       case NumToAck of
           1 ->
               {next_state, reply_to_client, S0#state{state=committed}, 0};
           _ ->
  -           {next_state, receive_committed, S0#state{num_to_ack= NumToAck-1}}
  +            {next_state, receive_committed, S0#state{num_to_ack=NumToAck-1}}
       end.
   
   %% @doc When an error occurs or an updated partition
   %%      does not pass the certification check, the transaction aborts.
  -abort(timeout, SD0=#state{transaction = Transaction,
  +abort(timeout, SD0=#state{transaction=Transaction,
                             updated_partitions=UpdatedPartitions}) ->
       clocksi_vnode:abort(UpdatedPartitions, Transaction),
       {next_state, reply_to_client, SD0#state{state=aborted},0};
   
  -abort(abort, SD0=#state{transaction = Transaction,
  +abort(abort, SD0=#state{transaction=Transaction,
                           updated_partitions=UpdatedPartitions}) ->
       clocksi_vnode:abort(UpdatedPartitions, Transaction),
       {next_state, reply_to_client, SD0#state{state=aborted},0}.
   
   %% @doc when the transaction has committed or aborted,
   %%       a reply is sent to the client that started the transaction.
  -reply_to_client(timeout, SD=#state{from=From, transaction=Transaction,
  -                                   state=TxState, commit_time=CommitTime}) ->
  +reply_to_client(timeout, SD=#state{from=From, transaction=Transaction, state=TxState, commit_time=CommitTime}) ->
       case undefined =/= From of
           true ->
  -          TxId = Transaction#transaction.txn_id,
  -          Reply = case TxState of
  -            committed ->
  -                DcId = dc_utilities:get_my_dc_id(),
  -                CausalClock = vectorclock:set_clock_of_dc(
  -                  DcId, CommitTime, Transaction#transaction.vec_snapshot_time),
  -                {ok, {TxId, CausalClock}};
  -            aborted->
  -                {aborted, TxId};
  -            Reason->
  -                {TxId, Reason}
  -          end,
  -          gen_fsm:reply(From, Reply);
  -        false -> ok
  +            TxId = Transaction#transaction.txn_id,
  +            Reply = case TxState of
  +                committed ->
  +                    DcId = dc_utilities:get_my_dc_id(),
  +                    CausalClock = vectorclock:set_clock_of_dc(DcId, CommitTime, Transaction#transaction.vec_snapshot_time),
  +                    {ok, {TxId, CausalClock}};
  +                aborted ->
  +                    {aborted, TxId};
  +                Reason ->
  +                    {TxId, Reason}
  +            end,
  +            gen_fsm:reply(From, Reply);
  +        false ->
  +            ok
       end,
       {stop, normal, SD}.
  -
  -
   
   %% =============================================================================
   
  
positive.code: %%
  %% -------------------------------------------------------------------
  %% @doc The coordinator for a given Clock SI interactive transaction.
  %%      It handles the state of the tx and executes the operations sequentially
  %%      by sending each operation to the responsible clockSI_vnode of the
  %%      involved key. when a tx is finalized (committed or aborted, the fsm
  %%      also finishes.
  
  -module(clocksi_interactive_tx_coord_fsm).
  
  
negative.code:             end
      end.
  
  %% @doc a message from a client wanting to start committing the tx.
  %%      this state sends a prepare message to all updated partitions and goes
  %%      to the "receive_prepared"state.
  prepare(timeout, SD0=#state{transaction=Transaction, updated_partitions=UpdatedPartitions, from=From}) ->
      case length(UpdatedPartitions) of
          0 ->
              SnapshotTime = Transaction#transaction.snapshot_time,
              gen_fsm:reply(From, {ok, SnapshotTime}),
              {next_state, committing, SD0#state{state=committing, commit_time=SnapshotTime}};
          _->
              clocksi_vnode:prepare(UpdatedPartitions, Transaction),
              NumToAck = length(UpdatedPartitions),
              {next_state, receive_prepared, SD0#state{num_to_ack=NumToAck, state=prepared}}
      end.
  
  %% @doc in this state, the fsm waits for prepare_time from each updated
  %%      partitions in order to compute the final tx timestamp (the maximum
  %%      of the received prepare_time).
  receive_prepared({prepared, ReceivedPrepareTime},
                   S0=#state{num_to_ack=NumToAck, from=From, prepare_time=PrepareTime}) ->
      MaxPrepareTime = max(PrepareTime, ReceivedPrepareTime),
      case NumToAck of
          1 ->
              gen_fsm:reply(From, {ok, MaxPrepareTime}),
              {next_state, committing, S0#state{prepare_time=MaxPrepareTime, commit_time=MaxPrepareTime, state=committing}};
          _ ->
              {next_state, receive_prepared, S0#state{num_to_ack=NumToAck-1, prepare_time=MaxPrepareTime}}
      end;
  
  receive_prepared(abort, S0) ->
  