Changed the way templates work (not significantly)