more refactoring, etc