Kernel cleanups

Here is some cleanups for the kernel tree. See issue #2.