loginwindow should be a global variable