Clean up module templates and code