changes to tf idf function