Migrates code from feature-emailnotification

Old branch is FUBAR, kill it with fire.