Added argparse and cleaned it up a bit.