Flags array refactoring