Refactoring test code to make it easier to test on 2/3