optparse -> argparse plus small changes