refactor examples and pass rubocop