moving tf function to Doc_Reader