Refactoring for unit tests.