added server side centroid computation