Modified to read data from file