created my own iterator pattern