handling multiple windows nicely