index: DRY the logic a bit