Parse and set arguments appropriately. Need to handle errors. Code is in desperate need of reorganization