Refactor testHelper, moving some code into the application