added debug and iterator