Improved formatting of templates