fix code: update after each iteration, check for centroid shift