upgrading memoize func