refactoring item search and add tests