Reuse previously computed data

This speed code up a bit by reusing some of the previously computed values