completely refactors email notifications