Neater tests and test case refactoring