Added a toggle for template matching