changed code to accept new text files

so far it seems to work