created search function