Clean template setting code.