Upadated API to read and write