improved tfidf computation