Query TFIDF completed.
Also fixed some weird code