updated email functionality