miscellaneous refactoring