Added flag parsing