minor update to the indexing logic