Reuse previously computed values, use more const.
Merge pull request #378 from Dmitry-Me/reusePreviouslyComputedValues

Reuse previously computed values, use more const.