AN_spectra has been refactored a little bit