update window logic