Modified to send email after snchronized