Added support for window resizing