added functions for reading file and counting words in list