Cancel restart notification on shutdown, minor refactoring.