Minor refactoring (preparing to unit test).