Heavily modified tf-idf script since last time, should run better now