Updated code to load HTML from external template