Refactoring to_s to template.