another round of refactoring