moved extraction code to Extractor