Refactored extractor to extract for each level, not working perfect yet and needs some refactoring