Refactor and speed up ContentExtractor.