A rough start on some refactoring, and a template module file.