Refactor test harness

* Mostly uses argparse instead of environment variables
* Broke the logic up into more functions