adding iterator and fixing the stuff enough for making it run again