refactoring. fix rubocop warnings