updated ex8.rb