Added ugly tool to do ri-queries