Added a check to make sure there are at least 2 libraries.
Fixup: made SAMPLE_NAME_PREFIX lazy.