refactoring making flags string

refactoring making flags string