Added higherPrime logic