added algorithm for polyline matching