modified email notification code