a couple of refactorings