Validation logic