refactored into a search and a display function