remove duplicate code for email