Updated code to read from a file of data