Improve template handling in module generator
Minor cosmetic adjustments