refactored read_data_file()