Use temp variable to omit recomputing the same value.
Merge pull request #366 from Dmitry-Me/useTempVariableToOmitRecomputation

Use temp variable to omit recomputing the same value.