Added locking to the indexer