core indexing code