cleanup factorization code
complete factorization cleanups