first step refactoring for tests