making flag selection dynamic