Updated to use new query format