memoize for performance.