refactored to validate email (issue #2)