iterators written with breadth-first algorithm. added max_width parameter
fixes for iterators