optimizate the path iterator