Improved history view

Little less sql-intensive and more compact view.