cleaned up solution for search result view bug