Clean up pagination in query class