more minor refactoring