Is there any real reason to use a set instead of a queryset for this function? We can improve performance by using querysets instead of updating a regular set with querysets. I can't see any problems with using querysets, but we'd also need to sort using `order_by` instead of `sorted`.