Completed temperature calculation, but some bugs remain!