Added ability to gracefully handle terminal window resizing. Fixes #25.