Added code for distinct degree factorization.