use each_with_object over inject