Tweaked code and saved as solution.rb #4