Refactor tests slightly