Replace cobbled together HTML with a template