just a wee bit of refactoring