changed return types of write and read