First edition of query language
Cleaned up some query building logic, reduced overhead by a small amount
Merge branch 'query-plans'