Renamed currentPrime variable to currentPrimeIndex for clarity