Changed the text pane to use the iterator instead of an array, and fixed
an infinite loop bug in the iterator