Follow-on to pull request 237, closurifying some code.