Improved dialog handling.