Refactor kernel.