More prime factorization improvements