Refactored validation