finish search func