refactored tfidf