diff --git a/includes/media.browser.inc b/includes/media.browser.inc
index 7c04c5b..ad18225 100644
--- a/includes/media.browser.inc
+++ b/includes/media.browser.inc
@@ -72,6 +72,33 @@ function media_browser($selected = NULL) {
           '#title' => $plugin['title'],
           '#weight' => isset($plugin['weight']) ? $plugin['weight'] : 0,
         );
+
+        // We need to get a submit and cancel button on each tab. If the plugin
+        // is not returning a form element we need to add a submit button.
+        // This is a fairly broad assumption.
+        if (empty($plugin_output[$key]['#form']) && ! empty($plugin_output[$key]['#markup'])) {
+          $plugin_output[$key]['#markup'] .= l(t('Submit'), '', array(
+            'attributes' => array('class' => array('button', 'fake-submit', $key))
+          ));
+          $plugin_output[$key]['#markup'] .= l(t('Cancel'), '', array(
+          'attributes' => array('class' => array('button', 'fake-cancel', $key))
+          ));
+        }
+
+        // I'm not sure if it is ever the case that a plugin form will ever have
+        // the correct cancel button so we add it here. Put it inline with the
+        // current submit button. This is a fairly broad assumption.
+        if (! empty($plugin_output[$key]['form'])) {
+          $button = l(t('Cancel'), '', array('attributes' => array('class' => array('button', 'fake-cancel', $key))));
+          if (! empty($plugin_output[$key]['form'][0]['submit']['#suffix'])) {
+            $plugin_output[$key]['form'][0]['submit']['#suffix'] .= $button;
+          }
+          else {
+            $plugin_output[$key]['form'][0]['submit']['#suffix'] = $button;
+          }
+
+        }
+
       }
     }
   }
@@ -84,6 +111,8 @@ function media_browser($selected = NULL) {
   $tabs = array(); // List of tabs to render.
 
   $settings = array('media' => array('browser' => array()));
+  drupal_add_js($settings, 'setting');
+
   $browser_settings =& $settings['media']['browser'];
 
   //@todo: replace with Tabs module if it gets upgraded.
@@ -107,14 +136,14 @@ EOS;
 EOS;
   }
 
-  drupal_add_js($settings, 'setting');
+
 
   $output['tabset'] = array(
     '#prefix' => '<div id="media-browser-tabset">',
     '#suffix' => '</div>',
   );
   $output['tabset']['list'] = array(
-    '#markup' => '<ul><li>' . implode('</li><li>', $tabs) . '</li></ul>'
+    '#markup' => theme('item_list', array('items' => $tabs)),
   );
 
   $output['tabset']['plugins'] = $plugin_output;
diff --git a/includes/media.theme.inc b/includes/media.theme.inc
index 90d270e..b68cfad 100644
--- a/includes/media.theme.inc
+++ b/includes/media.theme.inc
@@ -76,7 +76,6 @@ function theme_media_browser_thumbnails($variables) {
   return theme('item_list', array('items' => $thumbnails, 'attributes' => array('class' => 'media_content_navigator results')));
 }
 
-
 /**
  * Theme a thumbnail.
  * @param $variables
diff --git a/js/media.browser.js b/js/media.browser.js
index b65ac61..41bfcfe 100644
--- a/js/media.browser.js
+++ b/js/media.browser.js
@@ -45,31 +45,20 @@ Drupal.media.browser.validateButtons = function() {
   // "OK" and "Cancel" buttons that are outside the IFRAME. media.css contains
   // CSS rules that hide the outside buttons.
   //
-  // We don't add a "Submit" button if the form already has one, since in these
-  // cases, another round-trip to the server is needed before the user's
-  // selection is finalized. For these cases, when the form's real Submit
-  // button is clicked, the server either returns another form for the user to
-  // fill out, or else a completion page that contains or sets the
+  // If a submit button is present, another round-trip to the server is needed
+  // before the user's selection is finalized. For these cases, when the form's
+  // real Submit button is clicked, the server either returns another form for
+  // the user to fill out, or else a completion page that contains or sets the
   // Drupal.media.browser.selectedMedia variable. If the latter, then
   // Drupal.media.popups.mediaBrowser.mediaBrowserOnLoad() auto-triggers the
   // "OK" button action to finalize the selection and remove the IFRAME.
-  //
-  // @todo An alternate, less hacky solution would be most welcome.
-  if (!$('.form-submit', this).length) {
-    if (!$('.fake-ok', this).length) {
-      $('<a class="button fake-ok">' + Drupal.t('Submit') + '</a>').appendTo(this).bind('click', Drupal.media.browser.submit);
-    }
-    if (!$('.fake-cancel', this).length) {
-      $('<a class="button fake-cancel">' + Drupal.t('Cancel') + '</a>').appendTo(this).bind('click', Drupal.media.browser.submit);
-    }
-  }
-  else if (!($('.fake-cancel', this).length > 0)) {
-    var parent = $('.form-actions', this);
-    if (!parent.length) {
-      parent = $('form > div', this);
-    }
-    $('<a class="button fake-cancel">' + Drupal.t('Cancel') + '</a>').appendTo(parent).bind('click', Drupal.media.browser.submit);
-  }
+
+  // We need to check for the fake submit/cancel buttons that are used on
+  // non-form based pane content. On these items we need to bind the clicks
+  // so that media can be selected or the window can be closed.
+  $('a.button.fake-submit', this).bind('click', Drupal.media.browser.submit);
+  $('a.button.fake-cancel', this).bind('click', Drupal.media.browser.submit);
+
 };
 
 Drupal.media.browser.submit = function () {
diff --git a/js/media.format_form.js b/js/media.format_form.js
index a1d7420..d209618 100644
--- a/js/media.format_form.js
+++ b/js/media.format_form.js
@@ -15,8 +15,8 @@ Drupal.behaviors.mediaFormatForm = {
     // Add "Submit" and "Cancel" buttons inside the IFRAME that trigger the
     // behavior of the hidden "OK" and "Cancel" buttons that are outside the
     // IFRAME. See Drupal.media.browser.validateButtons() for more details.
-    $('<a class="button fake-ok">' + Drupal.t('Submit') + '</a>').appendTo($('#media-format-form')).bind('click', Drupal.media.formatForm.submit);
-    $('<a class="button fake-cancel">' + Drupal.t('Cancel') + '</a>').appendTo($('#media-format-form')).bind('click', Drupal.media.formatForm.submit);
+   // $('<a class="button fake-ok">' + Drupal.t('Submit') + '</a>').appendTo($('#media-format-form')).bind('click', Drupal.media.formatForm.submit);
+   // $('<a class="button fake-cancel">' + Drupal.t('Cancel') + '</a>').appendTo($('#media-format-form')).bind('click', Drupal.media.formatForm.submit);
 
     if (Drupal.settings.media_format_form.autosubmit) {
       $('.button.fake-ok').click();
diff --git a/media.views.inc b/media.views.inc
index da1c000..88c638a 100644
--- a/media.views.inc
+++ b/media.views.inc
@@ -44,6 +44,7 @@ function media_views_plugins() {
  * Display the view as a media browser.
  */
 function template_preprocess_media_views_view_media_browser(&$vars) {
+  module_load_include('inc', 'media', 'includes/media.browser');
   // Load file objects for each View result.
   $fids = array();
   foreach ($vars['rows'] as $index => $row) {
@@ -54,14 +55,21 @@ function template_preprocess_media_views_view_media_browser(&$vars) {
   // Render the preview for each file.
   foreach ($vars['rows'] as $index => $row) {
     $file = $files[$row->fid];
-    $preview = media_get_thumbnail_preview($file);
-    $preview = drupal_render($preview);
-    $vars['rows'][$index]->preview = $preview;
-    $vars['rows'][$index]->file = $file;
+    // Add url/preview to the file object
+    media_browser_build_media_item($file);
+    $vars['rows'][$index] = $file;
     // @todo Remove this hacky way of 'linking' each item to select it in the browser.
-    $vars['rows'][$index]->preview = l($preview, 'media/browser', array('html' => TRUE, 'query' => array('render' => 'media-popup', 'fid' => $row->fid)));
+    $vars['rows'][$index]->preview = l($file->preview, 'media/browser', array(
+      'html' => TRUE,
+      'attributes' => array(
+        'data-fid' => $row->fid,
+      ),
+      'query' => array('render' => 'media-popup', 'fid' => $row->fid)));
   }
 
+  // Add the files to JS so that they are accessible inside the browser
+  drupal_add_js(array('media' => array('files' => $files)), 'setting');
+
   // Add classes and wrappers from the style plugin.
   $handler  = $vars['view']->style_plugin;
 
@@ -73,24 +81,17 @@ function template_preprocess_media_views_view_media_browser(&$vars) {
 
   $vars['class'] = implode(' ', $class);
   $vars['wrapper_class'] = implode(' ', $wrapper_class);
-  $vars['wrapper_prefix'] = '<div id="container">';
+  $vars['wrapper_prefix'] = '<div id="container" class="' . implode(' ', $wrapper_class) . '">';
   $vars['wrapper_suffix'] = '</div>';
-  $vars['list_type_prefix'] = '<' . $handler->options['type'] . ' id="media-browser-library-list">';
+  $vars['list_type_prefix'] = '<' . $handler->options['type'] . ' id="media-browser-library-list" class="' . implode(' ', $class) . '">';
   $vars['list_type_suffix'] = '</' . $handler->options['type'] . '>';
 
-  if ($vars['wrapper_class']) {
-    $vars['wrapper_prefix'] = '<div id="container" class="' . $vars['wrapper_class'] . '">';
-  }
-
-  if ($vars['class']) {
-    $vars['list_type_prefix'] = '<' . $handler->options['type'] . ' id="media-browser-library-list" class="' . $vars['class'] . '">';
-  }
-
   // Run the prepared theming variables through a standard Views preprocess
   // function.
   template_preprocess_views_view_unformatted($vars);
 
   // Add media browser javascript and CSS.
   drupal_add_js(drupal_get_path('module', 'media') . '/js/plugins/media.library.js');
+  drupal_add_js(drupal_get_path('module', 'media') . '/js/plugins/media.views.js');
   drupal_add_css(drupal_get_path('module', 'media') . '/js/plugins/media.library.css');
 }
