redoing the mail functionality