added flex support