updated to include email validation function