Updated windowing code to allow resizing