PrimeFactors refactor