Refactored showErrorDialog to showDialog