semi finish the indexing operation, need more tests