refactored the validator code.