started working on read function