cleaning up kernel code