Extracting anonymous function to bound function
Extracting anonymous function to bound function

Makes the code a little easier to read. Also moving some variables
to a more specific scope.

jstrait/webgl-city,jstrait/webgl-city