refactor index computation within a collection for event paths