Added code for offline write and read