Greatly reduced the code, changed to argparse, now PEP8 compliant