finish the search function and download function