factorizing code