Refactors classes and tests.