modified iterator pattern