Refactor creation of search result elements