Clean + thermostat

Cleaned up some code and add functionality for the thermostat