change lambdaMax to wavelengthMax, change this.spectrum to local variable