adjusted exercise5.rb