Refactored both the models and the tests.