Refactoring.
Add test case.