refactored searchNames to search