Compiling templates