DiffFactorizer: modify code, add comments