completed to ex31.rb