search function improve