Fixes #201. small refactoring