Added automatic window resizing.