Divided the library quality function into a separate script