Added code for flag parsing