Added small primes check