* for PR#264: update CHANGES, add tests, small refactoring.
* refactoring