a few refactorings