Changed isPrime to be smarter!