rubocop: Refactor codes