implement SearchCommand
refactoring