Fixed startup/shutdown and added event-listeners