#23 further refactoring of indexing