Improved PrimeTest