Optimize a bit how temperature is calculated