Refactor factorizer.
Merge pull request #165 from skydb/refactor-factorizer

Refactor factorizer.