[WIP] Query builder improvements