refactoring domain logic.