Updated to extract templates from code