Change parties query to return parties in order