anchor.diff:              State = state:empty(),
   	    Context = #context{active = Active, blocked = Blocked,
                                  state = State, details = Det},
  -	    Search = fun(C) -> search(C) end,
   	    %% Interleave using driver.
  -            Ret = driver(Search, Context, ReplayState),
  +            Ret = driver(Context, ReplayState),
   	    %% Cleanup of any remaining processes.
   	    proc_cleanup(),
               lid:stop(),
  
positive.code: -type analysis_target() :: {module(), atom(), [term()]}.
  
  -type bound() :: 'inf' | non_neg_integer().
  
  -type context() :: #context{}.
  
  %% Driver return type.
  -type driver_ret() :: 'ok' | 'block' | {'error', error:error(), state:state()}.
  
  %% Scheduler notification.
  -type notification() :: 'after' | 'demonitor' | 'fun_exit' | 'halt' | 'link' |
  
negative.code: 	    handler(exit, Pid, Context, Reason)
      end.
  
  driver(Context, ReplayState) ->
      case state:is_empty(ReplayState) of
  	true -> driver_normal(Context);
  	false -> driver_replay(Context, ReplayState)
      end.
  
  driver_replay(Context, ReplayState) ->
      {Next, Rest} = state:trim_head(ReplayState),
      NewContext = run(Context#context{current = Next, error = ?NO_ERROR}),
      #context{blocked = NewBlocked} = NewContext,
      case state:is_empty(Rest) of
  	true ->
  	    case ?SETS:is_element(Next, NewBlocked) of
  		true -> abort;
  		false -> check_for_errors(NewContext)
  	    end;
  	false -> driver_replay(NewContext, Rest)
      end.	    
  
  driver_normal(#context{active = Active, current = LastLid,
  		       state = State} = Context) ->
      %% TODO: check wakeups (and spawned)
      Next =
  	case ?SETS:is_element(LastLid, Active) of
  	    true ->
  		TmpActive = ?SETS:to_list(?SETS:del_element(LastLid, Active)),
  		{LastLid,TmpActive, next};
  	    false ->
  		[Head|TmpActive] = ?SETS:to_list(Active),
  		{Head, TmpActive, current}
  	end,
      {NewContext, Insert} = run_no_block(Context, Next),
      insert_states(State, Insert),
      check_for_errors(NewContext).
  
  check_for_errors(#context{active = NewActive, blocked = NewBlocked,
  			  error = NewError, state = NewState} = NewContext) ->
      case NewError of
  	?NO_ERROR ->
  	    case ?SETS:size(NewActive) of
  		0 ->
  		    case ?SETS:size(NewBlocked) of
  			0 -> ok;
  			_NonEmptyBlocked ->
  			    Deadlock = error:new({deadlock, NewBlocked}),
  			    {error, Deadlock, NewState}
  		    end;
  		_NonEmptyActive -> driver_normal(NewContext)
  	    end;
  	_Other -> {error, NewError, NewState}
      end.
  
  run_no_block(#context{state = State} = Context, {Next, Rest, W}) ->
      NewContext = run(Context#context{current = Next, error = ?NO_ERROR}),
      #context{blocked = NewBlocked} = NewContext,
      case ?SETS:is_element(Next, NewBlocked) of
  	true ->
  	    case Rest of
  		[] -> {NewContext, {[], W}};
  		[RH|RT] ->
  		    NextContext = NewContext#context{state = State},
  		    run_no_block(NextContext, {RH, RT, current})
  	    end;
  	false -> {NewContext, {Rest, W}}
      end.
  
  insert_states(State, {Lids, current}) ->
      [state_save(state:extend(State, L)) || L <- Lids];
  insert_states(State, {Lids, next}) ->
      [state_save_next(state:extend(State, L)) || L <- Lids].
  
  %% After message handler.
  