For large libraries, sorting on each call to getLibrary may introduce a lot of latency.  At a minimum, I think we want to move the sort outside the synchronized block, but what might be better in the short and long term would be to sort in updateLibrary, because that is a relatively infrequent action.