diff --git a/media.module b/media.module
index 12d6996..2c23c1e 100644
--- a/media.module
+++ b/media.module
@@ -13,13 +13,13 @@
 /* ***************************************** */
 
 // A registry of variable_get defaults.
-require_once (dirname(__FILE__) . '/includes/media.variables.inc');
+require_once dirname(__FILE__) . '/includes/media.variables.inc';
 
 // Code relating to using media as a field.
-require_once (dirname(__FILE__) . '/includes/media.fields.inc');
+require_once dirname(__FILE__) . '/includes/media.fields.inc';
 
  // Functions for working with [[inline tags]] and wysiwyg editors.
-require_once (dirname(__FILE__) . '/includes/media.filter.inc');
+require_once dirname(__FILE__) . '/includes/media.filter.inc';
 
 /* ***************************************** */
 /* Hook Implementations                      */
@@ -94,7 +94,7 @@ function media_entity_info_alter(&$entity_info) {
 }
 
 /**
- * Access callback for files. Don't use this function, it will be removed!
+ * Access callback for files. This function is depricated.
  *
  * @todo Completely remove this function in favor of file_entity_access after
  * a few releases, to ensure rest of contib catches up.
@@ -104,7 +104,7 @@ function media_access($op, $account = NULL) {
 }
 
 /**
- * Implement of hook_menu().
+ * Implements hook_menu().
  */
 function media_menu() {
   // For managing different types of media and the fields associated with them.
@@ -222,7 +222,7 @@ function media_menu_local_tasks_alter(&$data, $router_item, $root_path) {
 }
 
 /**
- * Implement hook_admin_paths().
+ * Implements hook_admin_paths().
  */
 function media_admin_paths() {
   $paths['media/*/edit/*'] = TRUE;
@@ -309,7 +309,7 @@ function media_image_default_styles() {
         'data' => array('width' => 180, 'height' => 180),
         'weight' => 0,
       ),
-    )
+    ),
   );
   return $styles;
 }
@@ -403,7 +403,8 @@ function media_file_edit_url($fids) {
 
   if (count($fids) > 1) {
     return 'admin/content/file/edit-multiple/' . implode(' ', $fids);
-  } else {
+  }
+  else {
     return 'file/' . reset($fids) . '/edit';
   }
 }
@@ -444,10 +445,11 @@ function media_forms($form_id, $args) {
 /**
  * Implements hook_form_FIELD_UI_FIELD_SETTINGS_FORM_alter().
  *
- * @todo: Respect field settings in 7.x-2.x and handle them in the media widget UI
+ * @todo: Respect field settings in 7.x-2.x and handle them in the media widget
+ * UI.
  */
 function media_form_field_ui_field_settings_form_alter(&$form, &$form_state) {
-  // On file fields that use the media widget we need remove specific fields
+  // On file fields that use the media widget we need remove specific fields.
   if ($form['field']['type']['#value'] == 'file') {
     $fields = field_info_instances($form['#entity_type'], $form['#bundle']);
     if ($fields[$form['field']['field_name']['#value']]['widget']['type'] == 'media_generic') {
@@ -460,10 +462,11 @@ function media_form_field_ui_field_settings_form_alter(&$form, &$form_state) {
 /**
  * Implements hook_form_FIELD_UI_FIELD_EDIT_FORM_alter().
  *
- * @todo: Respect field settings in 7.x-2.x and handle them in the media widget UI
+ * @todo: Respect field settings in 7.x-2.x and handle them in the media widget
+ * UI.
  */
 function media_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
-  // On file fields that use the media widget we need remove specific fields
+  // On file fields that use the media widget we need remove specific fields.
   if ($form['#field']['type'] == 'file' && $form['instance']['widget']['type']['#value'] == 'media_generic') {
     $form['field']['settings']['display_field']['#access'] = FALSE;
     $form['field']['settings']['display_default']['#access'] = FALSE;
@@ -472,7 +475,7 @@ function media_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
     $form['instance']['settings']['file_extensions']['#maxlength'] = 255;
   }
 
-  // On image fields using the media widget we remove the alt/title fields
+  // On image fields using the media widget we remove the alt/title fields.
   if ($form['#field']['type'] == 'image' && $form['instance']['widget']['type']['#value'] == 'media_generic') {
     $form['instance']['settings']['alt_field']['#access'] = FALSE;
     $form['instance']['settings']['title_field']['#access'] = FALSE;
@@ -508,19 +511,18 @@ function media_form_file_entity_edit_alter(&$form, &$form_state) {
 }
 
 /**
- * Alter forms when using the media browser popup to use
- * media_browser_form_submit
+ * When using the media browser popup forms use media_browser_form_submit().
  */
 function media_form_alter(&$form, &$form_state, $form_id) {
   // If we're in the media browser, set the #media_browser key to true
   // so that if an ajax request gets sent to a different path, the form
-  // still uses the media_browser_form_submit callback
+  // still uses the media_browser_form_submit callback.
   if (current_path() == 'media/browser' && $form_id != 'views_exposed_form') {
     $form_state['#media_browser'] = TRUE;
   }
 
   // If the #media_browser key isset and is true we are using the browser
-  // popup, so add the media_browser submit handler
+  // popup, so add the media_browser submit handler.
   if (!empty($form_state['#media_browser'])) {
     $form['#submit'][] = 'media_browser_form_submit';
   }
@@ -533,25 +535,26 @@ function media_browser_form_submit($form, &$form_state) {
   $url = NULL;
   $parameters = array();
 
-  // Single upload
+  // Single upload.
   if (!empty($form_state['file'])) {
     $file = $form_state['file'];
     $url = 'media/browser';
     $parameters = array('query' => array('render' => 'media-popup', 'fid' => $file->fid));
   }
 
-  // Multi upload
+  // Multi upload.
   if (!empty($form_state['files'])) {
     $files = $form_state['files'];
     $url = 'media/browser';
     $parameters = array('query' => array('render' => 'media-popup', 'fid' => array_keys($files)));
   }
 
-  // If $url is set, we had some sort of upload, so redirect
+  // If $url is set there is an upload so redirect.
   if (!empty($url)) {
-    // We the user has access to edit media, we change the redirect to the file-edit url
-    // first, then secondly to the destionation decided above.
-    // @todo maybe check every file separately for update permissions instead of edit any file.
+    // When the user has access to edit media we change the redirect to the
+    // file-edit url first, then the destionation decided above.
+    // @todo maybe check every file separately for update permissions instead of
+    // edit any file.
     if (user_access('edit any files')) {
       $destination = $url . '?' . drupal_http_build_query($parameters['query']);
       $url = media_file_edit_url($parameters['query']['fid']);
@@ -631,12 +634,6 @@ function media_type_page_title($type) {
 
 /**
  * Process callback for the media_browser element.
- *
- * @param $element
- * @param $edit
- * @param $form_state
- * @param $form
- * @return array
  */
 function media_file_list_element_process($element, $edit, $form_state, $form) {
   $element['list'] = array(
@@ -644,7 +641,6 @@ function media_file_list_element_process($element, $edit, $form_state, $form) {
     '#options'  => $element['#options'],
     '#size'     => media_variable_get('file_list_size'),
   );
-
   return $element;
 }
 
@@ -660,13 +656,11 @@ function media_library() {
     'version' => !empty($info['version']) ? $info['version'] : '7.x-2.x',
   );
 
-  /**
-   * Contains libraries common to other media modules.
-   */
+  // Contains libraries common to other media modules.
   $libraries['media_base'] = array(
     'title' => 'Media base',
     'js' => array(
-      $path . '/js/media.core.js' => array('group' => JS_LIBRARY, 'weight' => - 5),
+      $path . '/js/media.core.js' => array('group' => JS_LIBRARY, 'weight' => -5),
       $path . '/js/util/json2.js' => array('group' => JS_LIBRARY),
       $path . '/js/util/ba-debug.min.js' => array('group' => JS_LIBRARY),
     ),
@@ -675,10 +669,8 @@ function media_library() {
     ),
   );
 
-  /**
-   * Includes resources needed to launch the media browser.  Should be included
-   * on pages where the media browser needs to be launched from.
-   */
+  // Includes resources needed to launch the media browser.  Should be included
+  // on pages where the media browser needs to be launched from.
   $libraries['media_browser'] = array(
     'title' => 'Media Browser popup libraries',
     'js' => array(
@@ -692,9 +684,7 @@ function media_library() {
     ),
   );
 
-  /**
-   * Resources needed in the media browser itself.
-   */
+  // Resources needed in the media browser itself.
   $libraries['media_browser_page'] = array(
     'title' => 'Media browser',
     'js' => array(
@@ -720,10 +710,8 @@ function media_library() {
 /**
  * Theme callback used to identify when we are in a popup dialog.
  *
- * We do this because most times the default theme will look terrible in the
- * browser.  So this will default to the administration theme, unless set otherwise.
- *
- * @return string
+ * Generally the default theme will look terrible in the media browser. This
+ * will default to the administration theme, unless set otherwise.
  */
 function media_dialog_get_theme_name() {
   return media_variable_get('dialog_theme', variable_get('admin_theme'));
@@ -732,15 +720,16 @@ function media_dialog_get_theme_name() {
 /**
  * A wrapper around simplexml to retrieve a given XML file.
  *
- * @param $url
+ * @param string $url
  *   The URL to the XML to retrieve.
- * @param $display_errors
+ * @param bool $display_errors
  *   Optional; if TRUE, then we'll display errors to the end user. They'll be
  *   logged to the watchdog in any case.
- * @param $refresh
+ * @param bool $refresh
  *   Optional; if TRUE, then we'll force a new load of the XML. Otherwise,
  *   a cached version will be retrieved if possible.
- * @return
+ *
+ * @return object
  *   A fully populated object, or FALSE on an error.
  */
 function media_retrieve_xml($url, $display_errors = FALSE, $refresh = FALSE) {
@@ -780,11 +769,8 @@ function media_retrieve_xml($url, $display_errors = FALSE, $refresh = FALSE) {
  *
  * @param string $url
  *   The original URL or embed code to parse.
- * @param optional string $form_field
- *   The field from FAPI when being validated, suitable for
- *   form_set_error(). If this is set, then a particular implementation
- *   may throw an error if it believes the URL to be malformed.
- * @return
+ *
+ * @return string
  *   The unique URI for the file, based on its stream wrapper, or NULL.
  *
  * @see media_parse_to_file()
@@ -862,12 +848,9 @@ function media_parse_to_file($url) {
 }
 
 /**
- * Silly function to recursively run check_plain on an array.
- *
- * There is probably something in core I am not aware of that does this.
+ * Utility function to recursively run check_plain on an array.
  *
- * @param $value
- * @param $key
+ * @todo There is probably something in core I am not aware of that does this.
  */
 function media_recursive_check_plain(&$value, $key) {
   $value = check_plain($value);
@@ -881,7 +864,7 @@ function media_element_info() {
   $types['media'] = array(
     '#input' => TRUE,
     '#process' => array('media_element_process'),
-    //'#value_callback' => 'media_element_value',
+    // '#value_callback' => 'media_element_value',
     '#element_validate' => array('media_element_validate'),
     '#theme_wrappers' => array('container'),
     '#progress_indicator' => 'throbber',
@@ -889,8 +872,10 @@ function media_element_info() {
     '#required' => FALSE,
     '#media_options' => array(
       'global' => array(
-        'types' => array(), // Example: array('image', 'audio');
-        'schemes' => array(), // Example: array('http', 'ftp', 'flickr');
+        // Example: array('image', 'audio');
+        'types' => array(),
+        // Example: array('http', 'ftp', 'flickr');
+        'schemes' => array(),
       ),
     ),
     '#attributes' => array(
@@ -899,14 +884,14 @@ function media_element_info() {
     '#attached' => array(
       'library' => array(
         array('media', 'media_browser'),
-        ),
+      ),
     ),
   );
   return $types;
 }
 
 /**
- * #process callback for the media form element.
+ * Process callback for the media form element.
  */
 function media_element_process(&$element, &$form_state, $form) {
   $fid = isset($element['#value']['fid']) ? $element['#value']['fid'] : 0;
@@ -929,7 +914,7 @@ function media_element_process(&$element, &$form_state, $form) {
     '#weight' => -100,
   );
 
-  // @todo This should be loaded from the JS in case of a failed form submission.
+  // @todo This should load from the JS in case of a failed form submission.
   $element['preview'] = array(
     '#prefix' => '<div class="preview launcher">',
     '#suffix' => '</div>',
@@ -947,14 +932,16 @@ function media_element_process(&$element, &$form_state, $form) {
     '#options' => array('fragment' => FALSE, 'external' => TRUE),
     '#weight' => 10,
   );
-  // @todo Figure out how to update the preview image after the Edit modal is closed.
+  // @todo Figure out how to update the preview image after the Edit modal is
+  // closed.
   $element['edit'] = array(
     '#type' => 'link',
     '#href' => 'media/' . $fid . '/edit/nojs',
     '#title' => t('Edit'),
     '#attributes' => array(
       'class' => array(
-        'ctools-use-modal', 'use-ajax', // Required for CTools modal to work.
+        // Required for CTools modal to work.
+        'ctools-use-modal', 'use-ajax',
         'ctools-modal-media-file-edit', 'button', 'edit',
       ),
     ),
@@ -988,18 +975,19 @@ function media_element_process(&$element, &$form_state, $form) {
     'data' => $setting,
   );
 
-  // hmm... Might need to think about this.
-  // All settings would likely apply to all media in a multi-value, but what about passing the existing fid?
-
+  // @todo: Might need to think about this. All settings would likely apply to
+  // all media in a multi-value, but what about passing the existing fid?
   module_load_include('inc', 'media', 'includes/media.browser');
   media_attach_browser_js($element);
 
   return $element;
-  // @todo: make this work for file and image fields
+  // @todo: make this work for file and image fields.
 }
 
 /**
- * Validate media form elements. The file type is validated during the upload process, but this is
+ * Validate media form elements.
+ *
+ * The file type is validated during the upload process, but this is necessary
  * necessary in order to respect the #required property.
  */
 function media_element_validate(&$element, &$form_state) {
@@ -1037,7 +1025,8 @@ function media_filter_info() {
     'description' => t('This filter will convert [[{type:media... ]] tags into markup.'),
     'process callback' => 'media_filter',
     'weight' => 2,
-    'tips callback' => 'media_filter_tips', // @TODO not implemented
+    // @TODO not implemented
+    'tips callback' => 'media_filter_tips',
   );
 
   // If the WYSIWYG module is enabled, add additional help.
@@ -1049,10 +1038,13 @@ function media_filter_info() {
 }
 
 /**
+ * Media thumbnail render function.
+ *
  * Returns a renderable array with the necessary classes to support a media
- * thumbnail.  Also provides default fallback images if no image is available.
+ * thumbnail. Also provides default fallback images if no image is available.
  *
- * @param $file
+ * @param object $file
+ *   A Drupal file object.
  *
  * @return array
  *   Renderable array.
@@ -1072,13 +1064,13 @@ function media_get_thumbnail_preview($file, $link = NULL) {
 /**
  * Check that the media is one of the selected types.
  *
- * @param $file
+ * @param object $file
  *   A Drupal file object.
- * @param $types
+ * @param array $types
  *   An array of media type names
- * @return
- *   An array. If the file type is not allowed, it will contain an error
- *   message.
+ *
+ * @return array
+ *   If the file type is not allowed, it will contain an error message.
  *
  * @see hook_file_validate()
  */
@@ -1182,7 +1174,7 @@ function media_form_file_entity_admin_files_alter(&$form, $form_state) {
   // selected and they try to switch between the "Thumbnail" and "List" local
   // tasks.
   $path = drupal_get_path('module', 'media');
-  require_once($path . '/includes/media.browser.inc');
+  require_once $path . '/includes/media.browser.inc';
   $form['#attributes']['class'][] = 'file-entity-admin-files-form';
   $form['#attached']['js'][] = $path . '/js/media.admin.js';
   $form['#attached']['css'][] = $path . '/css/media.css';
@@ -1229,7 +1221,7 @@ function media_views_api() {
 }
 
 /**
- * Implementation of hook_views_default_views().
+ * Implements hook_views_default_views().
  */
 function media_views_default_views() {
   return media_load_all_exports('media', 'views', 'view.inc', 'view');
@@ -1238,17 +1230,17 @@ function media_views_default_views() {
 /**
  * Fetches an array of exportables from files.
  *
- * @param $module
+ * @param string $module
  *   The module invoking this request. (Can be called by other modules.)
- * @param $directory
+ * @param string $directory
  *   The subdirectory in the custom module.
- * @param $extension
+ * @param string $extension
  *   The file extension.
- * @param $name
+ * @param string $name
  *   The name of the variable found in each file. Defaults to the same as
  *   $extension.
  *
- * @return
+ * @return array
  *   Array of $name objects.
  */
 function media_load_all_exports($module, $directory, $extension, $name = NULL) {
