Math and Quadtree fixes