improved templatest