refactors code on show page to correctly show user search term