Cleaning up the kernel code