Added lowerPrime logic