Add update_email function and test