Initial work on complex query support.