Cleaned up significantly through use of argparse module