refactoring spectralextraction