code in template now working