factorization and cleaning