API query builder cleanup (2)