reads in data in specified format