refactor 'New Window' menu handling