rework library listing and detection code
k