Fixing the spectrum function to work properly. Still needs to have an option made to use it.