add getwordfromline to remove unneccessary file reading