Refactored unit tests slightly