Minor speed up through caching arithmetic.