More refactoring to make the tests more concise