I think the calculation of `numCols` can be moved out of the closure so that it is only calculated once rather than every time the tileUrlFunction is called.