library detect code