search function implementation