Script that easily handles memoization of functions