Some template improvements