nice bit of refactoring