added hacky anomaly algorithm