Refactor and change some tests.