Closes #1874.
Make code more readable and use union instead of uniq/concat
Merge pull request #1877 from lukasolson/issue-1874

Fix table view in discover