better iteration of coordinates in getCenter