Refactor with each_with_object
Extract method
Extract method
Refactoring with tap