clean-up spectrum analysis code