anchor.diff:      case Status of
   	407 ->
   	    ProxyAuth = collect_auth_headers(Status, "Proxy-Authenticate", Responses),
  -	    logger:log(normal, "Aggregating ~p Proxy-Authenticate headers into response ~p ~s",
  -			[length(ProxyAuth), Status, Reason]),
  -	    logger:log(normal, "FREDRIK: PROXY AUTH :~n~p", [ProxyAuth]),
  +	    logger:log(debug, "Aggregating ~p Proxy-Authenticate headers into response '407 ~s'",
  +		      [length(ProxyAuth), Reason]),
   	    NewHeader = keylist:set("Proxy-Authenticate", ProxyAuth, Header),
   	    {Status, Reason, NewHeader, Body};
   	401 ->
   	    WWWAuth = collect_auth_headers(Status, "WWW-Authenticate", Responses),
  -	    logger:log(normal, "Aggregating ~p WWW-Authenticate headers into response ~p ~s",
  -			[length(WWWAuth), Status, Reason]),
  +	    logger:log(debug, "Aggregating ~p WWW-Authenticate headers into response '401 ~s'",
  +                       [length(WWWAuth), Reason]),
   	    NewHeader = keylist:set("WWW-Authenticate", WWWAuth, Header),
   	    {Status, Reason, NewHeader, Body};
   	_ ->
  
positive.code: % 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.
  % XXX if there is only a 503, we SHOULD generate a 500 instead - RFC3261 #16.7 bullet 6.
  make_final_response(Responses) ->
      TwoxxResponses = get_xx_responses(200, Responses),
      ThreexxResponses = get_xx_responses(300, Responses),
  
negative.code: collect_auth_headers2(Status, Key, [H | T], Res) ->
      collect_auth_headers2(Status, Key, T, Res).
  
  pick_response(4, FourxxResponses) ->
      lists:nth(1, lists:sort(fun pick_4xx_sort/2, FourxxResponses));
  pick_response(5, FivexxResponses) ->
      lists:nth(1, lists:sort(fun avoid_503_sort/2, FivexxResponses));
  pick_response(Nxx, Responses) ->
      lists:nth(1, Responses).
  
  pick_4xx_sort(A, B) ->
      Apref = is_4xx_preferred(A),
      Bpref = is_4xx_preferred(B),
      if
  	Apref == Bpref ->
  	    % A and B is either both in the preferred list, or both NOT in the preferred list.
  	    % Pick using numerical sort of response codes.
  	    {Anum, _, _, _} = A,
  	    {Bnum, _, _, _} = B,
  	    if
  		Anum =< Bnum ->
  		   true;
  		true ->
  		   false
  	    end;	    
  	Apref == true ->
  	    true;
  	true ->
  	    false
      end.
      
  is_4xx_preferred({Status, _, _, _}) ->
      lists:member(Status, [401, 407, 415, 420, 484]).
  
  avoid_503_sort({503, _, _, _}, _) ->
      false;
  avoid_503_sort({Anum, _, _, _}, {Bnum, _, _, _}) when Anum =< Bnum ->
      true;
  avoid_503_sort(_, _) ->
      false.
      
  get_xx_responses(Min, Responses) ->
      Max = Min + 99,
      lists:keysort(1, get_range_responses(Min, Max, Responses)).
  