bits of refactoring