revised kernel.c