template compilation