Modified to use quadtree not gmm