Changed dispatchEvent to handle the entirety of the execution of an event since the watchdog will handle exceptions of these threads. Other fixes to scheduler added as well.