Adapt avoid_crossing_perimeters code to the recent changes