read function implemented