Issue #32: Updated "next variation" algorithm to properly select next index instead of relying on incrementing metadata value.