code factorizing