added search data logic and unit tests