optimizate the path polygon