anchor.diff:  	case SnapshotDict of
   	[]->
   		{ok,[]};
  -	[H|T]->
  -		{CommitTime, Snapshot} = lists:last(orddict:filter(fun(Key, Value) -> 
  -				{is_snapshot_in_snapshot(Key, SnapshotTime),Value} end, [H|T])),
  +	[{_, [H|T]}]->
  +		lager:info("These are the stored Snapshots: ~p",[H|T]),
  +		{CommitTime, Snapshot} = lists:last(orddict:filter(fun(Key, _Value) -> 
  +				belongs_to_snapshot(Key, SnapshotTime, materialised_version) end, [H|T])),
   		{ok, {CommitTime, Snapshot}}
   	end.
   
  
positive.code: 	case OpsDict of
  	[]->
  		{ok, []};
  	[H|T]->
  		[{_,Ops}]=[H|T],
  		lager:info("operations that are in the operation store are: ~p",Ops),
  		lager:info("SnapshotTime=~p",[SnapshotTime]),
      	FilteredOps = orddict:filter(fun(Key, Value) -> {is_snapshot_in_snapshot(Key, SnapshotTime),Value} end, Ops),
      	{ok,[Op || { _Key, Op} <- FilteredOps]}
      end.
  
  
negative.code:     case get_latest_snapshot(SnapshotDict, SnapshotTime) of
      	{ok, []} ->
     		    lager:info("No snapshot for key ~p, checking for non-materialised operations.",[Key]),
     		    lager:info("OpsDict is: ~p",[OpsDict]),
              {ok, Ops}= get_ops_to_apply(OpsDict, SnapshotTime),
          	lager:info("Operations to apply are: ~p",[Ops]),
              case Ops of
              [] ->
              	Snapshot=Type:new();
              [[H|T]] ->
              	lager:info("Operations for key ~p are: ~p",[Key, [H|T]]),
              	{ok, Snapshot} = clocksi_materializer:get_snapshot(Type, SnapshotTime, [H|T]),
              	lager:info("last op is ~p", [lists:last([H|T])]),
              	CommitTime = (lists:last([H|T]))#clocksi_payload.commit_time,
              	lager:info("caching new snapshot= ~p.", [Snapshot]),
              	ets:insert(SnapshotCache, {Key, orddict:append(CommitTime,Snapshot, SnapshotDict)})
              end;
  		{ok, {SnapshotCommitTime, [LatestSnapshot]}} ->
  		    lager:info("Latest snapshot for key ~p is ~p, with commit time ~p.",[Key, LatestSnapshot, SnapshotCommitTime]),
              {ok, Ops}= get_ops_to_apply(OpsDict, SnapshotTime),
              case Ops of
              [] ->
              	Snapshot=LatestSnapshot;
              [[H|T]] ->
              	lager:info("applying operations since the latest snapshot's commit time..."),
                  {ok, Snapshot} = clocksi_materializer:update_snapshot(Type, LatestSnapshot, SnapshotTime, [H|T]),
              	{CommitTime, _Op}=T,
              	lager:info("caching new snapshot..."),
              	ets:insert(SnapshotCache, {Key, orddict:append(CommitTime,Snapshot, SnapshotDict)})
              end   
      end,
  	lager:info("snapshot: ~p", [Snapshot]),
  