Changed code to use a single entry point (dialog.php)