Add functions for factorization, clean the code.