More updates to email function