modified file reader. now working with corresponding indexes