modifications to spectrum.py