put intersectBox() in a closure function.

i put my changed intersectBox() function in a closure function,.