complete rewrite of mawstats in c++/AngularJS