restructing some of the test code