Started template matching and threading

not working yet