prefer each_with_object over inject for modifying hashes like this so you don't have to care about returning the object at the end of the block.