Polished the windows

Fixed various issues with window management.