Refactor code into heaters and thermostat