upgraded query system and added datatables