updated reader and writer and termdocfreq class