a little more refactoring