More complete "error"-handling. Support for "exit"-event.