updates to spectral envelope and power spectrum code