function to read the data files