DRY up temp calculation