Added some required fields and validation
added initial support for email notifications
fixed a debug error when history is empty