anchor.diff:  %%		wait for it to finish (synchronous) and go to the prepareOP to execute the next
   %%		operation.
   executeOp(timeout, SD0=#state{
  -                            currentOp=CurrentOp,
  -                            txid=TransactionId,
  -                            updated_partitions=UpdatedPartitions,
  -							read_set=ReadSet,
  -                            currentOpLeader=CurrentOpLeader}) ->    
  -    {OpType, Key, Param}=CurrentOp,                       
  +                          currentOp=CurrentOp,
  +                          txid=TransactionId,
  +                          updated_partitions=UpdatedPartitions,
  +                          read_set=ReadSet,
  +                          currentOpLeader=CurrentOpLeader}) ->
  +    {OpType, Key, Param}=CurrentOp,
       lager:info("ClockSI-Coord: Execute operation ~w ~n",[CurrentOp]),
  -	{IndexNode, _} = CurrentOpLeader,
  -	case OpType of
  -	read ->
  -		case clockSI_vnode:read_data_item(IndexNode, TransactionId, Key, Param) of
  -		error ->
  -			SD1=SD0,
  -			{next_state, abort, SD1};
  -		ReadResult -> 
  -        	NewReadSet=lists:append(ReadSet, ReadResult),
  -			lager:info("ClockSI-Coord: Read value added to read set: ~p",[CurrentOpLeader]),
  -			SD1=SD0#state{read_set=NewReadSet}
  -		end;
  -	update ->
  -		case clockSI_vnode:update_data_item(IndexNode, TransactionId, Key, Param) of
  -		ok ->
  -		    case lists:member(IndexNode, UpdatedPartitions) of
  -			false ->
  -				lager:info("ClockSI-Coord: Adding Leader node ~w, updt: ~w ~n",[IndexNode, UpdatedPartitions]),
  -				NewUpdatedPartitions= lists:append(UpdatedPartitions, [IndexNode]),
  -				SD1 = SD0#state{updated_partitions= NewUpdatedPartitions};
  -			true->
  -				SD1 = SD0
  -		    end;
  -		error ->
  -			SD1=SD0,
  -			{next_state, abort, SD1}
  -		end
  -	end, 
  +    {IndexNode, _} = CurrentOpLeader,
  +    case OpType of
  +        read ->
  +            case clockSI_vnode:read_data_item(IndexNode, TransactionId, Key, Param) of
  +                error ->
  +                    SD1=SD0,
  +                    {next_state, abort, SD1};
  +                ReadResult -> 
  +                    NewReadSet=lists:append(ReadSet, ReadResult),
  +                    lager:info("ClockSI-Coord: Read value added to read set: ~p",[CurrentOpLeader]),
  +                    SD1=SD0#state{read_set=NewReadSet}
  +            end;
  +        update ->
  +            case clockSI_vnode:update_data_item(IndexNode, TransactionId, Key, Param) of
  +                ok ->
  +                    case lists:member(IndexNode, UpdatedPartitions) of
  +                        false ->
  +                            lager:info("ClockSI-Coord: Adding Leader node ~w, updt: ~w ~n",[IndexNode, UpdatedPartitions]),
  +                            NewUpdatedPartitions= lists:append(UpdatedPartitions, [IndexNode]),
  +                            SD1 = SD0#state{updated_partitions= NewUpdatedPartitions};
  +                        true->
  +                            SD1 = SD0
  +                    end;
  +                error ->
  +                    SD1=SD0,
  +                    {next_state, abort, SD1}
  +            end
  +    end, 
       {next_state, prepareOp, SD1, 0}.
   
   %%	when the tx updates multiple partitions, a two phase commit protocol is started.
   %%	the prepare_2PC state sends a prepare message to all updated partitions and goes
   %%	to the "receive_prepared"state. 
   prepare_2PC(timeout, SD0=#state{txid=TransactionId, updated_partitions=UpdatedPartitions}) ->
  -	case length(UpdatedPartitions) of
  -	0->
  -		SnapshotTime=TransactionId#tx_id.snapshot_time,
  -	    {next_state, committing, SD0#state{state=prepared, commit_time=SnapshotTime}, 0};
  -	_->
  -		clockSI_vnode:prepare(UpdatedPartitions, TransactionId),
  -		NumToAck=length(UpdatedPartitions),
  -		{next_state, receive_prepared, SD0#state{txid=TransactionId, num_to_ack=NumToAck, state=prepared}}
  -	end.	
  -	
  +    case length(UpdatedPartitions) of
  +        0->
  +            SnapshotTime=TransactionId#tx_id.snapshot_time,
  +            {next_state, committing, SD0#state{state=prepared, commit_time=SnapshotTime}, 0};
  +        _->
  +            clockSI_vnode:prepare(UpdatedPartitions, TransactionId),
  +            NumToAck=length(UpdatedPartitions),
  +            {next_state, receive_prepared, SD0#state{txid=TransactionId, num_to_ack=NumToAck, state=prepared}}
  +    end.	
  +
   %%	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, prepare_time=PrepareTime}) ->		
  -	MaxPrepareTime = max(PrepareTime, ReceivedPrepareTime),
  +    MaxPrepareTime = max(PrepareTime, ReceivedPrepareTime),
       case NumToAck of 1 -> 
  -    	lager:info("ClockSI: Finished collecting prepare replies, start committing... Commit time: ~w~n",[MaxPrepareTime]),
  -	{next_state, committing, S0#state{prepare_time=MaxPrepareTime, commit_time=MaxPrepareTime, state=committing},0};
  -    _ ->
  -        lager:info("ClockSI: Keep collecting prepare replies~n"),
  -	{next_state, receive_prepared, S0#state{num_to_ack= NumToAck-1, prepare_time=MaxPrepareTime}}
  +            lager:info("ClockSI: Finished collecting prepare replies, start committing... Commit time: ~w~n",[MaxPrepareTime]),
  +            {next_state, committing, S0#state{prepare_time=MaxPrepareTime, commit_time=MaxPrepareTime, state=committing},0};
  +        _ ->
  +            lager:info("ClockSI: Keep collecting prepare replies~n"),
  +            {next_state, receive_prepared, S0#state{num_to_ack= NumToAck-1, prepare_time=MaxPrepareTime}}
       end;
   
   receive_prepared(abort, S0) ->
  -	{next_state, abort, S0, 0};   
  +    {next_state, abort, S0, 0};   
   
   receive_prepared(timeout, S0) ->
  -	{next_state, abort, S0 ,0}.
  +    {next_state, abort, S0 ,0}.
   
   %%	after receiving all prepare_times, send the commit message to all updated partitions,
   %% 	and go to the "receive_committed" state.
   committing(timeout, SD0=#state{txid=TransactionId, updated_partitions=UpdatedPartitions, commit_time=CommitTime}) -> 
  -	NumToAck=length(UpdatedPartitions),
  -	case NumToAck of
  -		0 ->
  -    		lager:info("ClockSI-Coord: No updated partitions. Committing and replying to client."),
  -			{next_state, reply_to_client, SD0#state{state=committed}, 0};
  -		_ ->
  -			clockSI_vnode:commit(UpdatedPartitions, TransactionId, CommitTime),
  -			{next_state, receive_committed, SD0#state{num_to_ack=NumToAck}}
  -	end.
  -	
  +    NumToAck=length(UpdatedPartitions),
  +    case NumToAck of
  +        0 ->
  +            lager:info("ClockSI-Coord: No updated partitions. Committing and replying to client."),
  +            {next_state, reply_to_client, SD0#state{state=committed}, 0};
  +        _ ->
  +            clockSI_vnode:commit(UpdatedPartitions, TransactionId, CommitTime),
  +            {next_state, receive_committed, SD0#state{num_to_ack=NumToAck}}
  +    end.
  +
   %%	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
  
positive.code: 
  init([From, ClientClock, Operations]) ->	
  
  	{ok, SnapshotTime}= get_snapshot_time(ClientClock),
  	TransactionId=#tx_id{snapshot_time=clockSI_vnode:now_milisec(SnapshotTime), server_pid=self()},            
      SD = #state{
                  from=From,
                  txid=TransactionId,
                  operations=Operations,
                  updated_partitions=[],
  		prepare_time=0,
                  read_set=[]
  		},
      {ok, prepareOp, SD, 0}.
  
  
  
negative.code:     gen_fsm:start_link(?MODULE, [From, ClientClock, Operations], []).
  
  finishOp(From, Key,Result) ->
      gen_fsm:send_event(From, {Key, Result}).
  
  %%%===================================================================
  %%% States
  %%%===================================================================
  