made the logic for wasfound in prefix search the same as term search
added comments for the searchForTerm method