Refactor into a while read loop.