minor refactoring, closes #138