More work on modal dialog refactoring (click to close bug still present)