A bit of code cleanup on kernel.cpp