Optimize the factorization method