TemplateDetector implementation