Implemented loop to move centroids