misc minor refactoring