Refactor reading to use a peekable char iterator.