Improve speed and readability of captureDefines.

Reduce closure levels and size of closures.
Make objects monomorphic.