Improved dialog handling