updated mainWindow method