refactor reduceFactor