a bit of refactoring for code climate