clean code of path iterator.