update the read function