Add keymappings for "quit".

This allows the user to quit by typing 'q' or pressing <Esc>.  The
previous behavior was that only closing the window would quit.
Eliminate goto.

Refactor the board reading loop into a separate function so we can use return
rather than goto. Slightly better design, though possibly less efficient.  If
performance becomes an issue, it might help to "inline" the helper function.