anchor.diff:      end.
   
   %% @doc get_log: Looks up for the operations logged in a particular log
  -%%		Input:	Log: Table identifier of the log
  -%%              LogId: Identifier of the log
  -%%		Return:	List of all the logged operations 
  --spec get_log(Log::term(), [Index::integer()]) -> list() | {error, atom()}.
  +%%    Input:  Log: Table identifier of the log
  +%%            LogId: Identifier of the log
  +%%    Return: List of all the logged operations
  +-spec get_log(log(), [integer()]) -> [op()] | {error, atom()}.
   get_log(Log, LogId) ->
       dets:lookup(Log, LogId).
   
  -
  -%% @doc preflist_member: Returns true if the Partition identifier is part of the Preflist
  +%% @doc preflist_member: Returns true if the Partition identifier is
  +%%              part of the Preflist
   %%      Input:  Partition: The partition identifier to check
   %%              Preflist: A list of pairs {Partition, Node}
   %%      Return: true | false
   -spec preflist_member(partition(), preflist()) -> boolean().
   preflist_member(Partition,Preflist) ->
  -    lists:any(fun({P,_}) -> P == Partition end, Preflist).
  +    lists:any(fun({P, _}) -> P =:= Partition end, Preflist).
   
   -ifdef(TEST).
   
   %% @doc Testing threshold_prune works as expected
   thresholdprune_test() ->
  -    Operations = [{log1, #operation{op_number=op1}},{log1,#operation{op_number=op2}},{log1,#operation{op_number=op3}},{log1,#operation{op_number=op4}},{log1,#operation{op_number=op5}}],
  -    Filtered = threshold_prune(Operations,op3),
  -    ?assertEqual([{log1,#operation{op_number=op3}},{log1,#operation{op_number=op4}},{log1,#operation{op_number=op5}}],Filtered).
  -
  -%% @doc Testing threshold_prune works even when there is no matching op_id
  +    Operations = [{log1, #operation{op_number=op1}},
  +                  {log1, #operation{op_number=op2}},
  +                  {log1, #operation{op_number=op3}},
  +                  {log1, #operation{op_number=op4}},
  +                  {log1, #operation{op_number=op5}}],
  +    Filtered = threshold_prune(Operations, op3),
  +    ?assertEqual([{log1, #operation{op_number=op3}},
  +                  {log1, #operation{op_number=op4}},
  +                  {log1, #operation{op_number=op5}}], Filtered).
  +
  +%% @doc Testing threshold_prune works even when there is no matching
  +%%      op_id.
   thresholdprune_notmatching_test() ->
  -    Operations = [{log1, #operation{op_number=op1}},{log1,#operation{op_number=op2}},{log1,#operation{op_number=op3}},{log1,#operation{op_number=op4}},{log1,#operation{op_number=op5}}],
  -    Filtered = threshold_prune(Operations,op6),
  -    ?assertEqual([],Filtered).
  -
  -%% @doc Testing get_log_from_map works in both situations, when the key is in the map and when the key is not in the map
  +    Operations = [{log1, #operation{op_number=op1}},
  +                  {log1, #operation{op_number=op2}},
  +                  {log1, #operation{op_number=op3}},
  +                  {log1, #operation{op_number=op4}},
  +                  {log1, #operation{op_number=op5}}],
  +    Filtered = threshold_prune(Operations, op6),
  +    ?assertEqual([], Filtered).
  +
  +%% @doc Testing get_log_from_map works in both situations, when the key
  +%%      is in the map and when the key is not in the map
   get_log_from_map_test() ->
       Dict = dict:new(),
       Dict2 = dict:store([floppy1, c], value1, Dict),
  
positive.code:     ?assertEqual({ok, value3}, get_log_from_map(Dict5, [floppy3,c])),
      ?assertEqual({error, no_log_for_preflist}, get_log_from_map(Dict5, [floppy5, c])).
  
  %% @doc Testing that preflist_member returns true when there is a match
  preflist_member_true_test() ->
      Preflist = [{partition1, node},{partition2, node},{partition3, node}],
      ?assertEqual(true, preflist_member(partition1, Preflist)).
  
  %% @doc Testing that preflist_member returns false when there is no match
  preflist_member_false_test() ->
      Preflist = [{partition1, node},{partition2, node},{partition3, node}],
      ?assertEqual(false, preflist_member(partition5, Preflist)).
  
negative.code:     {ok, State}.
  
  handle_handoff_data(Data, #state{logs_map=Map}=State) ->
      {LogId, #operation{op_number=OpId, payload=Payload}} = binary_to_term(Data),
      case get_log_from_map(Map, LogId) of
          {ok, Log} ->
  