Refactored tfidf, hasn't been tested