Using each_with_object.