Updated to use argparse rather then optparse