Completed p4 in Ruby