Refactor argparse code.