Refactored validation
Refactored validation.