did some better commenting in queryIndex so matt can better read my code