[+]function to minimize the template generating time