anchor.diff:  	    end
       end.
   
  +%%--------------------------------------------------------------------
  +%% Function: cancel_pending_targets(Targets)
  +%%           Targets = targetlist record()
  +%% Descrip.: Cancel all targets in state 'proceeding'.
  +%% Returns : NewTargets = targetlist record()
  +%%--------------------------------------------------------------------
   cancel_pending_targets(Targets) ->
  -    % send {cancel} to all PIDs in states other than completed and terminated
  +    %% send {cancel} to all PIDs in states other than completed and terminated
       NewTargets1 = cancel_targets_state(Targets, calling),
       cancel_targets_state(NewTargets1, proceeding).
   
  -cancel_targets_state(Targets, State) ->
  -    % send {cancel} to all PIDs in a specific State, return updated TargetList
  -    TargetsInState = targetlist:get_targets_in_state(State, Targets),
  -    lists:map(fun (ThisTarget) ->
  -    			[Pid] = targetlist:extract([pid], ThisTarget),
  -			gen_server:cast(Pid, {cancel, "cancel_targets_state"})
  +%%--------------------------------------------------------------------
  +%% Function: cancel_targets_state(Targets, TargetState)
  +%%           Targets     = targetlist record()
  +%%           TargetState = atom()
  +%% Descrip.: Cancel all targets in state TargetState.
  +%% Returns : NewTargets = targetlist record()
  +%%--------------------------------------------------------------------
  +cancel_targets_state(Targets, TargetState) when is_atom(TargetState) ->
  +    %% send {cancel} to all PIDs in a specific State, return updated TargetList
  +    TargetsInState = targetlist:get_targets_in_state(TargetState, Targets),
  +    lists:map(fun(ThisTarget) ->
  +		      [Pid] = targetlist:extract([pid], ThisTarget),
  +		      gen_server:cast(Pid, {cancel, "cancel_targets_state"})
   	      end, TargetsInState),
       NewTargets = mark_cancelled(TargetsInState, Targets),
       NewTargets.
   
  +%%--------------------------------------------------------------------
  +%% Function: mark_cancelled(Targets, TargetList)
  +%%           Targets    = list() of term()
  +%%           TargetList = targetlist record()
  +%% Descrip.: Marks a number of targets (Targets) as cancelled.
  +%% Returns : NewTargets = targetlist record()
  +%%--------------------------------------------------------------------
   mark_cancelled([], TargetList) ->
       TargetList;
   mark_cancelled([H | T], TargetList) ->
  
positive.code: printable_responses([Response | Rest]) ->
      lists:append([Response], printable_responses(Rest)).
  
  % look for 6xx responses, then pick the lowest but prefer
  % 401, 407, 415, 420 and 484 if we choose a 4xx and avoid
  % 503 if we choose a 5xx.
  make_final_response(Responses) ->
      TwoxxResponses = get_xx_responses(200, Responses),
      ThreexxResponses = get_xx_responses(300, Responses),
  
negative.code: 	    	    In ++ ".1"
  	    end
      end.
  
  %%--------------------------------------------------------------------
  %% Function: allterminated(State)
  %%           allterminated(TargetList)
  %%           State      = state record()
  %%           TargetList = targetlist record()
  %% Descrip.: Determine if all targets are terminated (that is, no
  %%           targets are in the states calling, trying or proceeding).
  %% Returns : true | false
  %%--------------------------------------------------------------------
  allterminated(State) when is_record(State, state) ->
      allterminated(State#state.targets);
  
  allterminated(TargetList) ->
      TargetsCalling = targetlist:get_targets_in_state(calling, TargetList),
      TargetsTrying = targetlist:get_targets_in_state(trying, TargetList),
  