Updated to change the logic for turning the cooling and heating on and off