anchor.diff:  %% @doc Find operations that are in List2 but not in List1
   -spec find_diff_ops(list(),list()) -> list().
   find_diff_ops(List1, List2) ->
  -    lists:filter(fun(X)-> lists:member(X, List1) == false end , List2).
  +    lists:filter(fun(X)-> lists:member(X, List1) == false end, List2).
   
   %% @doc Make a union of operations in L1 and L2
  -%% TODO: Possible to simplify?
  -%% FIXME: Add missing tests! And make sure that the tests also deal with corner cases, e.g. empty lists.
  --spec union_ops([{_,operation()}],[{_,operation()}],[{_,operation()}]) -> [{_,operation()}].
  +-spec union_ops([{_,operation()}],[{_,operation()}],[{_,operation()}]) ->
  +    [{_,operation()}].
   union_ops(L1, L2, []) ->
       lists:append(L1, L2);
   union_ops(L1, L2, [Op|T]) ->
  -    {_, #operation{op_number= OpId}} = Op,
  +    {_, #operation{op_number=OpId}} = Op,
       L3 = remove_dup(L1, OpId,[]),
       L4 = lists:append(L2, [Op]),
       union_ops(L3, L4, T).
  
positive.code: -export([start_link/5]).
  
  %% Callbacks
  -export([init/1, code_change/4, handle_event/3, handle_info/3,
           handle_sync_event/4, terminate/3]).
  
  %% States
  -export([prepare/2, execute/2, wait_append/2, wait_read/2, repair_rest/2 ]).
  
  %% The threshold of number of error messages for read/write. When error
  %% message reaches this limit, the operation can not succeed.
  -define(W_ERROR_THRESHOLD, ?N-?NUM_W+1).
  -define(R_ERROR_THRESHOLD, ?N-?NUM_R+1).
  
  -record(state, {
                  from :: pid(),
                  type :: term(),
                  log_id :: logid(),
                  payload = undefined :: term() | undefined,
                  readresult,
                  error_msg = [],
                  preflist :: preflist(),
  
negative.code:                 type=Type,
                  log_id=LogId,
                  payload=Payload,
                  opid=OpId,
                  readresult=[],
                  node_ops=[]},
      {ok, prepare, SD, 0}.
  
  %% @doc Prepare the write by calculating the _preference list_.
  