Added closure memoization