further refactoring on the dog search