Added an extra check in isPrime for values < 2