Added Comparator to sort libraries

Added an option to set a comparator on the fragment to sort the libraries, for example alphabetically.