Edited method for retrieving files to correct issue with invalid file paths.