Implement max_results and sort