added centroid calculation script