refactoring Extractor to use Optional