Refactoring of generalization processing to be more generic.