Added logic for extractor, fixed a few other minor bugs