Added basic template matching