refactor alert processing
refactor centroid calculation