Modify command line arg parsing so it is more reusable