Parallelized memoization code