#685: implemented and unit-tested
closes #685