organized flag parsing