refactoring domain validator