Use inject instead of each_with_object for 1.8.7 compability