add some error checking for when reading in the content of files