added isPrime function