moving code to templates 3