finish adding search function