added email handling