I added more comments and added additional logic to the funciton that reads the data file to catch more errors.