Minor nit, you can hoist this out of the loop.