Complete revision of indexing framework (WIP)