Replaced if else with optparse