Cleanup.
Restructure: module per file; function per kernel.