added read_data function