modified to add a check for email address