waypoint = waypointsMatches[0]
This is why I always consider [0] to be a code smell. It doesn't have a name afaik, but it should.