Added support for terminal resizing