Refactoring for code climate 2