A bit of refactoring