anchor.diff:                  case Flavor =:= 'none' of
                       true -> [];
                       false ->
  +                        Awakened = ordsets:subtract(
  +                                     NewSleepSetCandidates, NewSleepSet),
                           RestError = ordsets:del_element(Lid, OldErrorNxt),
                           ordsets:union(Awakened, RestError)
                   end
           end,
  +    NewLastBlocked = ordsets:is_element(Lid, NewBlocked),    
  +    [NewTraceTop#trace_state{
  +       last_blocked = NewLastBlocked,
  +       error_nxt = NewErrorNext,
  +       sleep_set = NewSleepSet}|
  +     PrevTrace].
  +
  +replay_update_trace(#trace_state{last = {Lid, _, _} = Selected} = ReplayTop,
  +                    Trace) ->
  +    CommonNewTraceTop = ReplayTop#trace_state{last = Selected},
  +    NewTraceTop = update_instr_info(Lid, Selected, CommonNewTraceTop),
  +    PossiblyRewrittenSelected = NewTraceTop#trace_state.last,
       PrevTrace =
           case PossiblyRewrittenSelected =:= Selected of
  -            true -> [PrevTraceTop|Rest];
  -            false -> rewrite_while_awaked(PossiblyRewrittenSelected,
  -                                          Selected,
  -                                          [PrevTraceTop|Rest])
  -        end,
  -    NewTrace =
  -        [NewTraceTop#trace_state{
  -           last = PossiblyRewrittenSelected,
  -           lid_trace = NewLidTrace,
  -           error_nxt = NewErrorNext,
  -           sleep_set = NewSleepSet}|
  -         PrevTrace],
  -    State#dpor_state{trace = NewTrace}.
  +            true -> Trace;
  +            false ->
  +                rewrite_while_awaked(PossiblyRewrittenSelected, Selected, Trace)
  +        end,
  +    [NewTraceTop|PrevTrace].
   
   recent_dependency_cv({_Lid, {ets, _Info}, _} = Transition,
  -                     ClockVector, LidTrace) ->
  +                     ClockVector, Trace) ->
       Fun =
  -        fun({Queue, CVAcc}) ->
  -            {Ret, NewQueue} = queue:out_r(Queue),
  -            case Ret of
  -                empty -> {done, CVAcc};
  -                {value, {Transition2, CV}} ->
  -                    case concuerror_deps:dependent(Transition, Transition2) of
  -                        true -> {cont, {NewQueue, max_cv(CVAcc, CV)}};
  -                        false -> {cont, {NewQueue, CVAcc}}
  -                    end
  -            end
  -        end,
  -    dynamic_loop_acc(Fun, {LidTrace, ClockVector});
  +        fun(#trace_state{
  +            last = {Lid, _, _} = Transition2,
  +            clock_map = CM}, CVAcc) ->
  +                case concuerror_deps:dependent(Transition, Transition2) of
  +                    true ->
  +                        CV = lookup_clock(Lid, CM),
  +                        max_cv(CVAcc, CV);
  +                    false -> CVAcc
  +                end
  +        end,
  +    lists:foldl(Fun, ClockVector, Trace);
   recent_dependency_cv(_Transition, ClockVector, _Trace) ->
       ClockVector.
  -
  -dynamic_loop_acc(Fun, Arg) ->
  -    case Fun(Arg) of
  -        {done, Ret} -> Ret;
  -        {cont, NewArg} -> dynamic_loop_acc(Fun, NewArg)
  -    end.
   
   update_lid_enabled(Lid, {_, Next, _}, Pollable, Enabled, Blocked) ->
       {NewEnabled, NewBlocked} =
  
positive.code: -record(trace_state, {
            i         = 0                 :: s_i(),
            last      = init_tr()         :: transition(),
            enabled   = ordsets:new()     :: ordsets:ordset(concuerror_lid:lid()),
            blocked   = ordsets:new()     :: ordsets:ordset(concuerror_lid:lid()),
            pollable  = ordsets:new()     :: ordsets:ordset(concuerror_lid:lid()),
  
negative.code: %% - add new entry with new entry
  %% - wait any possible additional messages
  %% - check for async
  update_trace(Selected, Next, State) ->
      #dpor_state{trace = Trace, dpor_flavor = Flavor} = State,
      NewTrace = update_trace(Selected, Next, Trace, Flavor),
      State#dpor_state{trace = NewTrace}.
  
  update_trace({Lid, _, _} = Selected, Next, [PrevTraceTop|_] = Trace, Flavor) ->
      #trace_state{i = I, enabled = Enabled, blocked = Blocked,
                   pollable = Pollable, done = Done, error_nxt = OldErrorNxt,
                   nexts = Nexts, clock_map = ClockMap, sleep_set = SleepSet,
                   preemptions = Preemptions, last = {LLid,_,_}} = PrevTraceTop,
      NewN = I+1,
      ClockVector = lookup_clock(Lid, ClockMap),
      ?debug("Happened before: ~p\n", [orddict:to_list(ClockVector)]),
      BaseClockVector = orddict:store(Lid, NewN, ClockVector),
      LidsClockVector = recent_dependency_cv(Selected, BaseClockVector, Trace),
      NewClockMap = dict:store(Lid, LidsClockVector, ClockMap),
      NewNexts = dict:store(Lid, Next, Nexts),
      MaybeNotPollable = ordsets:del_element(Lid, Pollable),
  