replace extraneous #each_with_object with #map