Refactor out tests