- validCoordinates method added.