Clean up

This function has been added to the centroid module.