Refactored email validation