cleaner validator logic
refactored - less repetition, easier to read