Better content negotiation code