Refactor kernel module.
This is the module that builds kernel files for confinement analysis. This is primarily a utility module - it produces a number of text files that are used as inputs to the confinement analysis, but it does not conduct any part of the analysis itself.
This issue is complete when the kernel file code is modular, has docstrings, and has tests.