re-implemented the query structure to be a filtered iterator