Completed p5 in Ruby