refactor to drop need for memoization