Added _contains() helper function for queries