Refactoring, unit tests.