Fix temperature conditianals and error in while loop