Indexer code with some fixes
Indexer code with some fixes