refactor ready to implement search.