replaced calls to optparse with argparse