Correctly forming result sets