Rearranged some code to make the fact that the term information is now independent of the search results clearer.