Refactoring FlagUtils