anchor.diff:  %% Private
   %% @doc recursively looks for the Vertex where the new element should be put to the right of.
   recursive_insert(_, Value, [], []) ->
  -    Inserted = {Value, os:timestamp()},
  +    Inserted = {ok, Value, os:timestamp()},
       {ok, Inserted, [Inserted]};
   recursive_insert(Vertex, Value, [Vertex | T], L) ->
  -    add_element({Value, os:timestamp()}, T, L ++ [Vertex]);
  +    add_element({ok, Value, os:timestamp()}, T, L ++ [Vertex]);
   recursive_insert(Vertex, Value, [H | T], L) ->
       recursive_insert(Vertex, Value, T, L ++ [H]).
   
   %% Private
   %% @doc the place for the insertion has been found, so now the TimeStamps are compared to see where to insert.
  -add_element({Value, TimeStamp}, [{Value1, TimeStamp1} | T], L) ->
  +add_element({Status, Value, TimeStamp}, [{Status1, Value1, TimeStamp1} | T], L) ->
       case TimeStamp >= TimeStamp1 of
           true ->
  -            {ok, {Value, TimeStamp}, L ++ [{Value, TimeStamp}] ++ [{Value1, TimeStamp1} | T]};
  +            {ok, {Status, Value, TimeStamp}, L ++ [{Status, Value, TimeStamp}] ++ [{Status1, Value1, TimeStamp1} | T]};
           _ ->
  -            add_element({Value, TimeStamp}, T, L ++ [{Value1, TimeStamp1}])
  +            add_element({Status, Value, TimeStamp}, T, L ++ [{Status1, Value1, TimeStamp1}])
       end;
   add_element(Insert, [], L) ->
       {ok, Insert, L ++ [Insert]}.
  
positive.code: -include_lib("eunit/include/eunit.hrl").
  %% -endif.
  
  -type vertex() :: {any(), any()}.
  
  -type rga_op() :: {addRight, vertex(), atom()} | {remove, vertex()}.
  
  -type rga_result() :: {ok, vertex(), rga()} | rga() .
  
  -type rga() :: list().
  
  
negative.code:     {ok, V2, L2} = update({addRight, V1, 2}, L1),
      {ok, _, L3} = update({addRight, V2, 3}, L2),
      L4 = update({remove, V1}, L3),
      ?assertMatch([{deleted, 1, _}, {ok, 2, _}, {ok, 3, _}], L4).
  
  remove_middle_element_test() ->
      L = new(),
      {ok, V1, L1} = update({addRight, {ok, 0, 0}, 1}, L),
      {ok, V2, L2} = update({addRight, V1, 2}, L1),
      {ok, _, L3} = update({addRight, V2, 3}, L2),
      L4 = update({remove, V2}, L3),
      ?assertMatch([{ok, 1, _}, {deleted, 2, _}, {ok, 3, _}], L4).
  
  remove_last_element_test() ->
      L = new(),
      {ok, V1, L1} = update({addRight, {ok, 0, 0}, 1}, L),
      {ok, V2, L2} = update({addRight, V1, 2}, L1),
      {ok, V3, L3} = update({addRight, V2, 3}, L2),
      L4 = update({remove, V3}, L3),
      ?assertMatch([{ok, 1, _}, {ok, 2, _}, {deleted, 3, _}], L4).
  
  pruge_tombstones_test() ->
      L = new(),
      {ok, V1, L1} = update({addRight, {ok, 0, 0}, 1}, L),
      {ok, V2, L2} = update({addRight, V1, 2}, L1),
      {ok, _, L3} = update({addRight, V2, 3}, L2),
      L4 = update({remove, V2}, L3),
      L5 = purge_tombstones(L4),
      ?assertMatch([{ok, 1, _}, {ok, 3, _}], L5).
  
  -endif.
  
  