written logic to write and read index