Refactored to have getPath() method to get the directory of text files