only one form of memoization is needed