Make the resources order by weight, in addition to resource types.

Previously, only the resource types were being ordered correctly. Now, the ordering of the resources themselves has been fixed.