Add indexing logic