Refined the behavior of dialogs and overriding the global alert function.