refactored index queries into util directory