bit of refactoring