anchor.diff:      end,
       {ok, lists:flatmap(MapFun, Ops)}.
   
  -%% @doc Check whether a Key's operation or stored snapshot is included
  -%%		in a snapshot defined by a vector clock
  -%%      Input: Dc = Datacenter Id
  -%%             CommitTime = local commit time of this Snapshot at DC
  -%%             SnapshotTime = vector clock
  -%%      Outptut: true or false
  +%% @doc Check whether a commit time is included in a snapshot time.
   -spec belongs_to_snapshot(commit_time(), snapshot_time()) -> boolean().
   belongs_to_snapshot({Dc, CommitTime}, SnapshotTime) ->
  -	{ok, Ts}= vectorclock:get_clock_of_dc(Dc, SnapshotTime),
  +	{ok, Ts} = vectorclock:get_clock_of_dc(Dc, SnapshotTime),
   	CommitTime =< Ts.
   
  -%% @doc Operation to insert a Snapshot in the cache and start
  -%%      Garbage collection triggered by reads.
  +%% @doc Operation to insert a snapshot in the cache and start
  +%%      garbage collection triggered by reads.
   -spec snapshot_insert_gc(key(), orddict:orddict(), orddict:orddict(), ets:tid() , ets:tid() ) -> true.
   snapshot_insert_gc(Key, SnapshotDict, OpsDict, SnapshotCache, OpsCache)->
       case (orddict:size(SnapshotDict))==?SNAPSHOT_THRESHOLD of
           true ->
  -            PrunedSnapshots=orddict:from_list(lists:sublist(orddict:to_list(SnapshotDict), 1+?SNAPSHOT_THRESHOLD-?SNAPSHOT_MIN, ?SNAPSHOT_MIN)),
  -            FirstOp=lists:nth(1, PrunedSnapshots),
  +            PrunedSnapshots = orddict:from_list(lists:sublist(orddict:to_list(SnapshotDict), 1+?SNAPSHOT_THRESHOLD-?SNAPSHOT_MIN, ?SNAPSHOT_MIN)),
  +            FirstOp = lists:nth(1, PrunedSnapshots),
               {CommitTime, _S} = FirstOp,
  -            PrunedOps=prune_ops(OpsDict, CommitTime),
  +            PrunedOps = prune_ops(OpsDict, CommitTime),
               ets:insert(SnapshotCache, {Key, PrunedSnapshots}),
               ets:insert(OpsCache, {Key, PrunedOps});
           false ->
  
positive.code:                                     },
      op_insert_gc(Key,DownstreamOp1, OpsCache, SnapshotCache),
      io:format("after making the first write: Opscache= ~p~n SnapCache=~p", [orddict:to_list(OpsCache), orddict:to_list(SnapshotCache)]),
      {ok, Res1} = internal_read(ignore, Key, Type, vectorclock:from_list([{DC1,16}]),ignore,  OpsCache, SnapshotCache),
      ?assertEqual(1, Type:value(Res1)),
      io:format("after making the first read: Opscache= ~p~n SnapCache=~p", [orddict:to_list(OpsCache), orddict:to_list(SnapshotCache)]),
      %% Insert second increment
  
negative.code: 
  %% @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(pid() | ignore, key(), type(), snapshot_time(), txid() | ignore, ets:tid(), ets:tid()) -> {ok, snapshot()} | {error, no_snapshot}.
  internal_read(Sender, Key, Type, SnapshotTime, TxId, OpsCache, SnapshotCache) ->
      {SnapDict, LatestSnapshot, SnapshotCommitTime} = case ets:lookup(SnapshotCache, Key) of
          [] ->
              {orddict:new(), clocksi_materializer:new(Type), ignore};
          [{_, SnapshotDict}] ->
              case get_latest_snapshot(SnapshotDict, SnapshotTime) of
                  {ok, no_snapshot} ->
                      {SnapshotDict, clocksi_materializer:new(Type), ignore};
                  {ok, {SCT, LS}} ->
                      {SnapshotDict, LS, SCT}
              end
      end,
      case ets:lookup(OpsCache, Key) of
  