checked centroids with Davide fixes #2