factor out dispatching on content type
move `quality` method into separate class

This should allow it to be used by exception handling