Moved data-getting functionality out of stats view.
Added simple tests for stats views.