refactoring a little more