Refact Prime and PrimeTest