Improve efficiency and add histograms, update UI.