added error checking for duplicate email.