Refactored the search() and view_collection() functions by moving repeated code blocks into the new list_fetcher() function.