Remove the closures from the loop body

This is the first step in hoisting them.

See #66.