flex code modified