Added missing files, refactored ui_switch_win to check win exists