Refactor LibraryManager.