refactored searchCommand to AbstractCommand