added email notification and tests