Modified to improve accuracy of the coordinates.