refactored to use argparse