Refactoring with rubocop