refactor flags struct