Finish the template builder and part of template extractor.