Edited the kernel() function.