Speeding up weighted centroids considerably