Fixed a bunch of silly errors  pointed out by Andrew, Also added a temperature sensor. It still doesn't like to conserve energy too much...