#225 solution.
refacotry to remove global to reset iterator by adding a new class.