more minor refactoring for #120