Better accept header handling and lots more test coverage