template matching done