getCoordinates function now working