Fixed indentation and added a shuttingdown event.