improved template sysyem