Improved library handling