again edited to read from index