Pull the templates set-up code into its own module.