WIP Notification functionality

Minor refactorings
Progress in notifications, added template engine and ability to send
html emails.