restructured and using argparse for command line arguments