code refine - change to distanceR and centerX