Completed part4.rb