Template generator/extractor