libSpectrum cleaned and restructured