get rid of 'spectrum' global var; other misc tweaks