Filter and sort at the same time.