Refactoring Quadtree