Updated memoize and logging.