refactor Flags