added grayscale template matching