refactoring validation class