Wrapped generateBezier in an IIF to memoize functions