Added assertions and comments to get_index
merge