added and changed the kernel code