Use temp variable to omit recomputing the same value.