Completed p3 in Ruby