anchor.diff:  
   %%---------------- Internal Functions -------------------%%
   
  -%% @doc This function takes care of reading. It is implemented here for not blocking the 
  -%% vnode when the write function calls it. That is done for garbage collection. 
  --spec internal_read(term(),term(), atom(), vectorclock:vectorclock(), atom() , atom() ) -> ok.
  +%% @doc This function takes care of reading. It is implemented here for not blocking the
  +%% vnode when the write function calls it. That is done for garbage collection.
  +-spec internal_read(term(),term(), atom(), vectorclock:vectorclock(), atom() , atom() ) -> {ok, term()} | {error, atom()}.
   internal_read(Sender, Key, Type, SnapshotTime, OpsCache, SnapshotCache) ->
  -    % get the latest snapshot for the key
  +                                                % get the latest snapshot for the key
       case ets:lookup(SnapshotCache, Key) of
  -    	[] ->
  -    		NewSnapshot=clocksi_materializer:new(Type),
  +        [] ->
  +            NewSnapshot=clocksi_materializer:new(Type),
               case ets:lookup(OpsCache, Key) of
               [] ->
               	riak_core_vnode:reply(Sender, {ok, NewSnapshot});
  
positive.code: %%             SnapshotTime = vector clock
  %%      Outptut: true or false
  -spec belongs_to_snapshot({Dc::term(),CommitTime::non_neg_integer()},
                          SnapshotTime::vectorclock:vectorclock()) -> boolean()|error.
  belongs_to_snapshot({Dc, CommitTime}, SnapshotTime) ->
      case vectorclock:get_clock_of_dc(Dc, SnapshotTime) of
          {ok, Ts} ->
  
negative.code:             	{ok, Snapshot, CommitTime} = clocksi_materializer:materialize(Type, NewSnapshot, SnapshotTime, Ops, TxId),
              	riak_core_vnode:reply(Sender, {ok, Snapshot}),
              	SnapshotDict=orddict:new(),
              	ets:insert(SnapshotCache, {Key, orddict:store(CommitTime,Snapshot, SnapshotDict)}), 
              	{ok, Snapshot}
              end;
          [{_, SnapshotDict}] ->
              case get_latest_snapshot(SnapshotDict, SnapshotTime) of
                  {ok, {_SnapshotCommitTime, LatestSnapshot}}->
                      case ets:lookup(OpsCache, Key) of
                          [] ->
                              riak_core_vnode:reply(Sender, {ok, LatestSnapshot}),
                              {ok, LatestSnapshot};
                          [{_, OpsDict}] ->
                              {ok, Ops}= filter_ops(OpsDict),
                              case Ops of
                                  [] ->
                                      riak_core_vnode:reply(Sender, {ok, LatestSnapshot}),
                                      {ok, LatestSnapshot};
                                  [H|T] ->
                                      LastOp=lists:last([H|T]),
                                      TxId = LastOp#clocksi_payload.txid,
                                      {ok, Snapshot, CommitTime} = clocksi_materializer:materialize(Type, LatestSnapshot, SnapshotTime, Ops, TxId),
                                      Res = case (Sender /= ignore) of
                                                true ->
                                                    riak_core_vnode:reply(Sender, {ok, Snapshot}),
                                                    {ok, Snapshot};
                                                false ->
                                                    {ok, Snapshot}
                                            end,
                                      SnapshotDict1=orddict:store(CommitTime,Snapshot, SnapshotDict),
                                      snapshot_insert_gc(Key,SnapshotDict1, OpsDict, SnapshotCache, OpsCache),
                                      Res
                              end
                      end;
                  {error, no_snapshot} ->
                      %%FIX THIS, READ FROM THE LOG WHEN THERE IS NO SNAPSHOT.
                      riak_core_vnode:reply(Sender, {error, no_snapshot}),
                      {error, no_snapshot}
              end
      end.
  
  %%TODO: trigger the GC mechanism asynchronously
  
  %% @doc This function takes care of appending an operation to the log and
  %%  to the cache.
  -spec internal_update(term(), Key::term(), DownstreamOp::clocksi_payload(),
                        OpsCache::atom(), SnapshotCache::atom()) ->	ok.
  internal_update(Sender, Key, DownstreamOp, OpsCache, SnapshotCache) ->
      %% TODO: Remove unnecessary information from op_payload in log_Record
      LogRecord = #log_record{tx_id=DownstreamOp#clocksi_payload.txid,
                              op_type=downstreamop,
                              op_payload=DownstreamOp},
  