Add rolling histogram and factor out anomaly detection