anchor.diff:  				end;
   			{ok, no_snapshot} ->
   				%%FIX THIS, READ FROM THE LOG WHEN THERE IS NO SNAPSHOT.
  -				Snapshot=no_snapshot,
  -				{reply, {ok, Snapshot}, State}
  +				Snapshot=no_snapshot
   			end	
       end,
   	%lager:info("materialiser_vnode: snapshot: ~p", [Snapshot]),
  -	{reply, {ok, Snapshot}, State};
  +	Snapshot.
   	%TODO: trigger the GC mechanism asynchronously
   	%{async, snapshot_gc(), Sender, State};
  -
  -handle_command({update, Key, DownstreamOp}, _Sender,
  -               State = #state{ops_cache = OpsCache})->
  -    %% 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},
  -    LogId = log_utilities:get_logid_from_key(Key),
  -    [Node] = log_utilities:get_preflist_from_key(Key),
  -    case logging_vnode:append(Node,LogId,LogRecord) of
  -        {ok, _} ->
  -        	case ets:lookup(OpsCache, Key) of
  -        	[]->
  -        		%lager:info("storing the first operation for the key"),
  -        		OpsDict=orddict:new();
  -        	[{_, OpsDict}]->
  -        		OpsDict
  -        	end,
  -        	%lager:info("operation being stored: ~p", [DownstreamOp]),
  -        	OpsDict1=orddict:append(DownstreamOp#clocksi_payload.commit_time, DownstreamOp, OpsDict),
  -        	%lager:info("materialiser_vnode: OpsDict= ~p",[OpsDict1]),
  -            true = ets:insert(OpsCache, {Key, OpsDict1}),
  -            {reply, ok, State};
  -        {error, Reason} ->
  -            {reply, {error, Reason}, State}
  -    end;
  -
  -handle_command(_Message, _Sender, State) ->
  -    {noreply, State}.
  -
  -handle_handoff_command(?FOLD_REQ{foldfun=Fun, acc0=Acc0} ,
  -                       _Sender,
  -                       State = #state{ops_cache = OpsCache}) ->
  -    F = fun({Key,Operation}, A) ->
  -                Fun(Key, Operation, A)
  -        end,
  -    Acc = ets:foldl(F, Acc0, OpsCache),
  -    {reply, Acc, State}.
  -
  -handoff_starting(_TargetNode, State) ->
  -    {true, State}.
  -
  -handoff_cancelled(State) ->
  -    {ok, State}.
  -
  -handoff_finished(_TargetNode, State) ->
  -    {ok, State}.
  -
  -handle_handoff_data(Data, State = #state{ops_cache = OpsCache}) ->
  -    {Key, Operation} = binary_to_term(Data),
  -    true = ets:insert(OpsCache, {Key, Operation}),
  -    {reply, ok, State}.
  -
  -encode_handoff_item(Key, Operation) ->
  -    term_to_binary({Key, Operation}).
  -
  -is_empty(State=#state{ops_cache = OpsCache}) ->
  -    case ets:first(OpsCache) of
  -        '$end_of_table' ->
  -            {true, State};
  -        _ ->
  -            {false, State}
  -    end.
  -
  -delete(State=#state{ops_cache=OpsCache}) ->
  -    true = ets:delete(OpsCache),
  -    {ok, State}.
  -
  -handle_coverage(_Req, _KeySpaces, _Sender, State) ->
  -    {stop, not_implemented, State}.
  -
  -handle_exit(_Pid, _Reason, State) ->
  -    {noreply, State}.
  -
  -terminate(_Reason, _State) ->
  -    ok.
   
   
   %% @doc Obtains, from an orddict of Snapshots, the latest snapshot that can be included in 
  
positive.code: 
  -define(SNAPSHOT_THRESHOLD, 10).
  -define(SNAPSHOT_MIN, 2).
  -define(OPS_THRESHOLD, 50).
  -define(OPS_MIN, 5).
  
  -export([start_vnode/1,
           read/3,
  
negative.code: 				(belongs_to_snapshot(Threshold,(lists:last(Value))#clocksi_payload.snapshot_time)) end, OpsDict).
  
  
  %% @doc Insert an operation and start garbage collection triggered by writes.
  %% the mechanism is very simple; when there are more than OPS_THRESHOLD
  %% operations for a given key, just perform a read, that will trigger
  %% the GC mechanism.
  
  op_insert_gc(Key,DownstreamOp, OpsDict, OpsCache, SnapshotCache)-> 
      case (orddict:size(OpsDict))>=?OPS_THRESHOLD of 
      true ->
  	    lager:info("too many operations: time to GC: ~p"),
  	    Type=DownstreamOp#clocksi_payload.type,
  	    SnapshotTime=DownstreamOp#clocksi_payload.snapshot_time,
  	    lager:info("redading key: ~p ~n type: ~p ~n snapshot time: ~p", [Key, Type, SnapshotTime]),
  	    Type=DownstreamOp#clocksi_payload.type,
  	    SnapshotTime=DownstreamOp#clocksi_payload.snapshot_time,
  	    internal_read(Key, Type, SnapshotTime, OpsCache, SnapshotCache);
  	false ->
  		continue
      end,
      lager:info("operation being stored: ~p", [DownstreamOp]),
      OpsDict1=orddict:append(DownstreamOp#clocksi_payload.commit_time, DownstreamOp, OpsDict),
      lager:info("materialiser_vnode: OpsDict= ~p",[OpsDict1]),
      true = ets:insert(OpsCache, {Key, OpsDict1}).
  
       
      
      
      
  