First pass at porting the QueryBuilder