Updated query functions to allow paging on filtered results; custom order of locations