Added argparse and fixed some minor wrinkles