minor refactorings, take two