Modified ex8.rb