changed code to look at a training image instead of adjacent frames
added a couple comments