Updated to use the new memoization.