improve sorting of the fragments

Now we sort initially on the order number and then on the resource name.