cleaned up kernel code