anchor.diff:  		[_] -> Variances2;
   		[_|_] -> [<<"accept-charset">>|Variances2]
   	end,
  -	{Variances4, Req3, State2} = case call(Req, State, variances) of
  -		no_call ->
  -			{Variances3, Req, State};
  +	try variances(Req, State, Variances3) of
  +		{Variances4, Req2, State2} ->
  +			case [[<<", ">>, V] || V <- Variances4] of
  +				[] ->
  +					resource_exists(Req2, State2);
  +				[[<<", ">>, H]|Variances5] ->
  +					Req3 = cowboy_req:set_resp_header(
  +						<<"vary">>, [H|Variances5], Req2),
  +					resource_exists(Req3, State2)
  +			end
  +	catch Class:Reason ->
  +		error_logger:error_msg(
  +			"** Cowboy handler ~p terminating in ~p/~p~n"
  +			"   for the reason ~p:~p~n** Handler state was ~p~n"
  +			"** Request was ~p~n** Stacktrace: ~p~n~n",
  +			[State#state.handler, variances, 2,
  +				Class, Reason, State#state.handler_state,
  +				cowboy_req:to_list(Req), erlang:get_stacktrace()]),
  +		error_terminate(Req, State)
  +	end.
  +
  +variances(Req, State, Variances) ->
  +	case unsafe_call(Req, State, variances) of
  +		no_call ->
  +			{Variances, Req, State};
   		{HandlerVariances, Req2, HandlerState} ->
  -			{Variances3 ++ HandlerVariances, Req2,
  +			{Variances ++ HandlerVariances, Req2,
   				State#state{handler_state=HandlerState}}
  -	end,
  -	case [[<<", ">>, V] || V <- Variances4] of
  -		[] ->
  -			resource_exists(Req3, State2);
  -		[[<<", ">>, H]|Variances5] ->
  -			Req4 = cowboy_req:set_resp_header(
  -				<<"vary">>, [H|Variances5], Req3),
  -			resource_exists(Req4, State2)
   	end.
   
   resource_exists(Req, State) ->
  
positive.code: generate_etag(Req, State=#state{etag=no_call}) ->
  	{undefined, Req, State};
  generate_etag(Req, State=#state{etag=undefined}) ->
  	case call(Req, State, generate_etag) of
  		no_call ->
  			{undefined, Req, State#state{etag=no_call}};
  		{Etag, Req2, HandlerState} when is_binary(Etag) ->
  
negative.code: 	end.
  
  if_none_match(Req, State, EtagsList) ->
  	try generate_etag(Req, State) of
  		{Etag, Req2, State2} ->
  			case Etag of
  				undefined ->
  					precondition_failed(Req2, State2);
  				Etag ->
  					case lists:member(Etag, EtagsList) of
  						true -> precondition_is_head_get(Req2, State2);
  						false -> if_modified_since_exists(Req2, State2)
  					end
  			end
  	catch Class:Reason ->
  		error_logger:error_msg(
  			"** Cowboy handler ~p terminating in ~p/~p~n"
  			"   for the reason ~p:~p~n** Handler state was ~p~n"
  			"** Request was ~p~n** Stacktrace: ~p~n~n",
  			[State#state.handler, generate_etag, 2,
  				Class, Reason, State#state.handler_state,
  				cowboy_req:to_list(Req), erlang:get_stacktrace()]),
  		error_terminate(Req, State)
  	end.
  
  precondition_is_head_get(Req, State=#state{method=Method})
  