Added isPrime function.