finalizing the index