improve write and read
improve comments