Refactoring kernel restarting.