Sort packages before returning