Added further code for spectrum integration