Updated kernel.cpp