completed search function