This should be in a method. There is business logic here but that is not communicated.
I think `map` would be better than `each` here. There is no need to modify the `titles` hash.