More work refactoring.
WYCS: added new test case.