Separate test code into smaller more logical pieces