change algorithm for idf portion