remediated memoization to relax memory footprint