Further refactoring non-Rhino stuff into the kernel module.