Refactor inner function into closure.
Refactor inner function into closure.

So we can cut some params by using stuff from the environment.

GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust