RI-Tree Cleanup, Fixes and UseRiTreeQuery Setting