first version of term frequency working