yet more refactoring