Add fn to check template validity