Move library search to functions