diff --git dialog.js dialog.js
index f57ac5c..70ca450 100644
--- dialog.js
+++ dialog.js
@@ -200,11 +200,12 @@
         .addClass('ctools-use-dialog-processed')
         .click(Drupal.Dialog.clickFormButton);
       
-      var buttons = {}, buttonsMap = {};
+      var buttons = {}, buttonsMap = {}, hasButtons = false;
       $('.ctools-dialog-button:not(.ctools-dialog-button-processed)', context)
         .addClass('ctools-dialog-button-processed')
         .hide()
         .each(function() {
+          hasButtons = true;
           var text = $(this).is('input') ? $(this).attr('value') : $(this).text();
           buttonsMap[text] = this;
           buttons[text] = function(e) {
@@ -217,6 +218,9 @@
         });
       $(context).data('dialogButtonsMap', buttonsMap);
       $(context).dialog('option', 'buttons', buttons);
+      if (hasButtons) {
+        $(context).parent('.ui-dialog').addClass('dialog-has-buttons');
+      }
     }
   };
 
@@ -265,9 +269,15 @@
    * Display loading
    */
   Drupal.CTools.AJAX.commands.dialog_loading = function(command) {
-    Drupal.CTools.AJAX.commands.dialog_display({
+    var command = {
       output: Drupal.theme('DialogThrobber'),
-      title: Drupal.t('Loading...')
-    });
+      title: Drupal.t('Loading...'),
+      options: {}
+    };
+    if (Drupal.Dialog.dialog.dialog('isOpen')) {
+      command.options.width = Drupal.Dialog.dialog.parent().width() + 'px';
+      command.options.height = Drupal.Dialog.dialog.parent().height() + 'px';
+    }
+    Drupal.CTools.AJAX.commands.dialog_display(command);
   }
 })(jQuery);
diff --git dialog.module dialog.module
index 451a27f..04fadc8 100644
--- dialog.module
+++ dialog.module
@@ -50,7 +50,7 @@ function dialog_add_js() {
       'width' => variable_get('dialog_default_width', '600px'),
     )
   );
-  
+
   drupal_add_js($settings, 'setting');
   drupal_add_js('misc/jquery.form.js');
   ctools_add_js('ajax-responder');
@@ -142,7 +142,12 @@ function dialog_form_wrapper($form_id, &$form_state) {
 
   $output = ctools_build_form($form_id, $form_state);
   if (!empty($form_state['ajax']) && empty($form_state['executed'])) {
-    return dialog_form_render($form_state, $output);
+    $options = array();
+    $function = $form_id . '_dialog_options';
+    if (function_exists($function)) {
+      $options = $function($form_state);
+    }
+    return dialog_form_render($form_state, $output, $options);
   }
 
   return $output;
@@ -151,7 +156,7 @@ function dialog_form_wrapper($form_id, &$form_state) {
 /**
  * Render a form into an AJAX display.
  */
-function dialog_form_render($form_state, $output) {
+function dialog_form_render($form_state, $output, $options = array()) {
   $title = empty($form_state['title']) ? '' : $form_state['title'];
 
   // If there are messages for the form, render them.
@@ -164,7 +169,7 @@ function dialog_form_render($form_state, $output) {
     $commands[] = ctools_ajax_command_settings($form_state['js settings']);
   }
 
-  $commands[] = dialog_command_display($title, $output);
+  $commands[] = dialog_command_display($title, $output, $options);
   return $commands;
 }
 
@@ -172,13 +177,13 @@ function dialog_form_render($form_state, $output) {
 /**
  * Generic dialog replacement for drupal_get_form().  Suitable for use as the
  * page callback in a menu item.
- * 
- * This function introduces a new form callback function to handle the 
+ *
+ * This function introduces a new form callback function to handle the
  * post-submit dialog commands, in the ajax context.  This function takes the
- * form of form_id_dialog_success.  If this function is found, it will be 
+ * form of form_id_dialog_success.  If this function is found, it will be
  * automatically called after a valid submission of the form has been detected.
- * If the function does not exist, a redirect will be issued based on the 
- * redirect value in the form_state array.  As the final fallback, if the 
+ * If the function does not exist, a redirect will be issued based on the
+ * redirect value in the form_state array.  As the final fallback, if the
  * redirect value is missing or empty, a client-side reload command is issued.
  *
  * @param $id
@@ -208,7 +213,16 @@ function dialog_get_form($form_id, $js) {
         $output = $func($form_state);
       }
       else if (!empty($form_state['redirect'])) {
-        $output[] = ctools_ajax_command_redirect($form_state['redirect']);
+        $options = array();
+        if (is_array($form_state['redirect'])) {
+          $redirect = array_shift($form_state['redirect']);
+          $options['query'] = array_shift($form_state['redirect']);
+          $options['fragment'] = array_shift($form_state['redirect']);
+        }
+        else {
+          $redirect = $form_state['redirect'];
+        }
+        $output[] = ctools_ajax_command_redirect($redirect, 0, $options);
       }
       else {
         $output[] = ctools_ajax_command_reload();
@@ -225,6 +239,6 @@ function dialog_get_form($form_id, $js) {
  * Process variables for dialog-content.tpl.php.
  */
 function template_preprocess_dialog_content(&$variables) {
-  $variables['help'] = theme('help');  
+  $variables['help'] = theme('help');
   $variables['messages'] = theme('status_messages');
 }
