Improved flexible version