template complete, working