Added less retarded isPrime function