Adding memoize to engine and return engine