working on quadtree matrix