Updated signature of 'generalize' methods to improve code maintainability. Added further regression tests.