Added check for library availability in admin interface, some refactoring.