Make quadtrees generic