Generalsied to any iterator