Updating shutdown function