Added handling for adding a new window at runtime