slight refactoring of indexall method