Memoize for correctness