added support for flex