Factor out an Extractor class, clean up the output format