Changed calculation for centerX and CenterY