Add support for resizing windows

    And remove unused code.