diff --git a/accessible_fix/accessible_fix.css b/accessible_fix/accessible_fix.css
index e69de29..c82ab71 100644
--- a/accessible_fix/accessible_fix.css
+++ b/accessible_fix/accessible_fix.css
@@ -0,0 +1,41 @@
+/**
+ * Invisible fieldsets.
+ *
+ * @see accessible_fix_form_element()
+ */
+fieldset.fieldset-invisible {
+  margin: 0;
+  padding: 0;
+  border: none;
+  display: inherit;
+}
+fieldset.fieldset-invisible > legend {
+  margin: 0;
+  padding: 0;
+  border: none;
+  outline: 0;
+  font-style: inherit;
+  font-size: 100%;
+  font-family: inherit;
+  vertical-align: baseline;
+
+  border-radius: 0;
+  color: inherit;
+  background-color: transparent;
+  background-image: none;
+
+  display: block;
+  font-weight: bold;
+
+  position: static;
+  left: 0;
+  right: 0;
+  top: 0;
+  bottom: 0;
+  
+  text-indent: 0;
+  text-shadow: none;
+  line-height: normal;
+  width: auto;
+  height: auto;
+}
diff --git a/accessible_fix/accessible_fix.info b/accessible_fix/accessible_fix.info
index 0560962..fc4e1e2 100644
--- a/accessible_fix/accessible_fix.info
+++ b/accessible_fix/accessible_fix.info
@@ -15,3 +15,5 @@ files[] = accessible_fix.install
 files[] = accessible_fix.module
 files[] = module_fixes/block.test
 ;files[] = module_fixes/filter.test
+
+stylesheets[all][] = accessible_fix.css
diff --git a/accessible_fix/accessible_fix.module b/accessible_fix/accessible_fix.module
index a1dcc55..9f86397 100644
--- a/accessible_fix/accessible_fix.module
+++ b/accessible_fix/accessible_fix.module
@@ -18,6 +18,8 @@
  */
 function accessible_fix_theme_registry_alter(&$theme_registry) {
 
+  $theme_registry['form_element']['function'] = 'accessible_fix_form_element';
+
   $overridden_tpls = accessible_api_settings('overridden_tpls');
   if (!is_array($overridden_tpls)) {
     return;
@@ -401,3 +403,103 @@ function accessible_fix_accessible_api_settings_alter(&$new_settings, &$old_sett
     }
   }
 }
+
+function accessible_fix_form_element($variables) {
+  $element = &$variables['element'];
+  // This is also used in the installer, pre-database setup.
+  $t = get_t();
+
+  // This function is invoked as theme wrapper, but the rendered form element
+  // may not necessarily have been processed by form_builder().
+  $element += array(
+    '#title_display' => 'before',
+  );
+
+  // Add element #id for #type 'item'.
+  if (isset($element['#markup']) && !empty($element['#id'])) {
+    $attributes['id'] = $element['#id'];
+  }
+  // Add element's #type and #name as class to aid with JS/CSS selectors.
+  $attributes['class'] = array('form-item');
+  if (!empty($element['#type'])) {
+    $attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
+  }
+  if (!empty($element['#name'])) {
+    $attributes['class'][] = 'form-item-' . strtr($element['#name'], array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
+  }
+  // Add a class for disabled elements to facilitate cross-browser styling.
+  if (!empty($element['#attributes']['disabled'])) {
+    $attributes['class'][] = 'form-disabled';
+  }
+  $output = '<div' . drupal_attributes($attributes) . '>' . "\n";
+
+  // Composite elements consist of more than one HTML form control. These must be grouped by a fieldset.
+  // Developers can mark any fieldtype as composite with #composite.
+  // radios, checkboxes, and date are marked as composite. In D8, they are so marked in their respective form_process_*().
+  if (in_array($element['#type'], array('radios', 'checkboxes', 'date'), true)) {
+    $element['#composite'] = true;
+  }
+  $composite = false;
+  if (isset($element['#composite']) && $element['#composite'] === true) {
+    $composite = true;
+  }
+
+  if ($composite) {
+    $output .= '<fieldset' . drupal_attributes(array('class' => 'fieldset-invisible')) . '>';
+  }
+
+  // If #title is not set, we don't display any label or required marker.
+  if (!isset($element['#title'])) {
+    $element['#title_display'] = 'none';
+  }
+  $prefix = isset($element['#field_prefix']) ? '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ' : '';
+  $suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>' : '';
+  $children = ' ' . $prefix . $element['#children'] . $suffix;
+
+  // Generate the title, either a legend or a label, only if the title will be used
+  if (!in_array($element['#title_display'], array('none', 'attribute'))) {
+    if ($composite) {
+      $attributes = array();
+      if ($element['#title_display'] == 'invisible') {
+        $attributes['class'] = 'element-invisible';
+      }
+      $title = '<legend' . drupal_attributes($attributes) . '>' . $element['#title'];
+      if (!empty($element['#required'])) {
+        $title .= theme('form_required_marker', array('element' => $element));
+      }
+      $title .= '</legend>';
+    } else {
+      $title = ' ' . theme('form_element_label', $variables);
+    }
+  }
+
+  switch ($element['#title_display']) {
+    case 'before':
+    case 'invisible':
+      $output .= $title . $children;
+      break;
+
+    case 'after':
+      $output .= $children . $title;
+      break;
+
+    case 'none':
+    case 'attribute':
+      // Output no label and no required marker, only the children.
+      $output .= $children;
+      break;
+  }
+  $output .= "\n";
+
+  if (!empty($element['#description'])) {
+    $output .= '<div class="description">' . $element['#description'] . "</div>\n";
+  }
+
+  if ($composite) {
+    $output .= '</fieldset>';
+  }
+
+  $output .= "</div>\n";
+
+  return $output;
+}
