Add rolling histogram and factor out anomaly detection

Type comment