refactoring for the sake of code climate