Adding advanced query support.