find library logic