some re-ordering + added integrated temperature checking.