implementing quadtree