Improved formatting method in templates.