Implementing search function.