Added argparse and fixed simplify()