replace scan_vars with get_rtree