Adds a greedy sorting algorithm and optimization params, also adds a reversal for the polylines