Improves performance by replacing block.call with yield.
Replaces keys.each by each_key (where possible).