Remove unneeded flattening and extra object allocations.
Reduce duplication of methods that run hooks.