Improvements on Email notification function