diff --git a/includes/media_webcam.admin.inc b/includes/media_webcam.admin.inc
index 2f4b18d..e5954ec 100644
--- a/includes/media_webcam.admin.inc
+++ b/includes/media_webcam.admin.inc
@@ -8,9 +8,7 @@
 /**
  * The administrative settings form for Media: Webcam.
  */
-function media_webcam_settings() {
-  $form = array();
-
+function media_webcam_settings($form) {
   $form['webcam'] = array(
     '#type' => 'fieldset',
     '#title' => t('Webcam flash recorder settings'),
diff --git a/includes/themes/css/img/camera.png b/includes/themes/css/img/camera.png
deleted file mode 100644
index 956ca70..0000000
Binary files a/includes/themes/css/img/camera.png and /dev/null differ
diff --git a/includes/themes/css/img/play-over.png b/includes/themes/css/img/play-over.png
deleted file mode 100644
index 2b58d80..0000000
Binary files a/includes/themes/css/img/play-over.png and /dev/null differ
diff --git a/includes/themes/css/img/play.png b/includes/themes/css/img/play.png
deleted file mode 100644
index ccbe7b6..0000000
Binary files a/includes/themes/css/img/play.png and /dev/null differ
diff --git a/includes/themes/css/img/record-over.png b/includes/themes/css/img/record-over.png
deleted file mode 100644
index 328beaf..0000000
Binary files a/includes/themes/css/img/record-over.png and /dev/null differ
diff --git a/includes/themes/css/img/record.png b/includes/themes/css/img/record.png
deleted file mode 100644
index accf990..0000000
Binary files a/includes/themes/css/img/record.png and /dev/null differ
diff --git a/includes/themes/css/img/sprite.png b/includes/themes/css/img/sprite.png
new file mode 100644
index 0000000..0fb80c8
Binary files /dev/null and b/includes/themes/css/img/sprite.png differ
diff --git a/includes/themes/css/img/stop-disabled.png b/includes/themes/css/img/stop-disabled.png
deleted file mode 100644
index db24a88..0000000
Binary files a/includes/themes/css/img/stop-disabled.png and /dev/null differ
diff --git a/includes/themes/css/img/stop-over.png b/includes/themes/css/img/stop-over.png
deleted file mode 100644
index 2c00cb7..0000000
Binary files a/includes/themes/css/img/stop-over.png and /dev/null differ
diff --git a/includes/themes/css/img/stop.png b/includes/themes/css/img/stop.png
deleted file mode 100644
index d7747c8..0000000
Binary files a/includes/themes/css/img/stop.png and /dev/null differ
diff --git a/includes/themes/css/media_webcam.css b/includes/themes/css/media_webcam.css
index 6f536d8..21aa0a4 100644
--- a/includes/themes/css/media_webcam.css
+++ b/includes/themes/css/media_webcam.css
@@ -6,40 +6,33 @@
  */
 
 .media-webcam-button {
-  width: 40px;
-  height: 40px;
+  width: 48px;
+  height: 48px;
   float: left;
   margin: 5px;
   background-repeat: no-repeat;
   display: block;
-  cursor:pointer;cursor:hand
+  text-indent: -10000px;
+  cursor:pointer;
+  position: relative;
+  background: url(img/sprite.png) no-repeat top left;
+  opacity: 0.8;
 }
-
-.media-webcam-record {
-  background-image: url(img/record.png);
+.media-webcam-button:hover {
+  opacity: 1;
 }
-.media-webcam-record:hover {
-  background-image: url(img/record-over.png);
+.media-webcam-button:active {
+  top: 1px;
 }
-
 .media-webcam-stop {
-  background-image: url(img/stop.png);
+  background-position: 0 -294px; 
 }
-.media-webcam-stop:hover {
-  background-image: url(img/stop-over.png);
-}
-
 .media-webcam-play {
-  background-image: url(img/play.png);
+  background-position: 0 -196px; 
 }
-.media-webcam-play:hover {
-  background-image: url(img/play-over.png);
-}
-
 .media-webcam-snap {
-  background-image: url(img/camera.png);
+  background-position: 0 -98px;
 }
-
 .media-webcam-textfield {
   display: none;
 }
diff --git a/includes/themes/js/media_webcam.js b/includes/themes/js/media_webcam.js
index 81b71e7..e544101 100644
--- a/includes/themes/js/media_webcam.js
+++ b/includes/themes/js/media_webcam.js
@@ -40,66 +40,68 @@
   }
 
   // Add the flash to the page.
-  Drupal.behaviors.mediaWebcamAddFlash = function(context) {
-    for (var flashId in Drupal.settings.mediaWebcam.flash) {
-      // Bind the record & stop buttons to the flash trigger behavior.
-      $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-record:not(.mediaWebcamAddFlash-processed)', context).each(function() {
-        $(this).addClass('mediaWebcamAddFlash-processed')
-          .bind('click', function(e) {
-            Drupal.mediaWebcam.recordClick($(this));
-          })
-          .data('flashId', flashId);
-      });
-      $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-stop:not(.mediaWebcamAddFlash-processed)', context).each(function() {
-        $(this).addClass('mediaWebcamAddFlash-processed')
-          .bind('click', function(e) {
-            Drupal.mediaWebcam.stopClick($(this));
-          })
-          .data('flashId', flashId);
-        $(this).data('red5_textfield', '#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-red5');
-      });
-      $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-play:not(.mediaWebcamAddFlash-processed)', context).each(function() {
-        $(this).addClass('mediaWebcamAddFlash-processed')
-          .bind('click', function(e) {
-            Drupal.mediaWebcam.playClick($(this));
-          })
-          .data('flashId', flashId);
-      });
-      $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-snap:not(.mediaWebcamAddFlash-processed)', context).each(function() {
-        $(this).addClass('mediaWebcamAddFlash-processed')
-          .bind('click', function(e) {
-            Drupal.mediaWebcam.snapClick($(this));
-          })
-          .data('flashId', flashId);
-        $(this).data('red5_snap_textarea', '#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-snap-textarea');
-      });
-      $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ':not(.mediaWebcamAddFlash-processed)', context).each(function() {
-        $(this).addClass('mediaWebcamAddFlash-processed');
-
-        // Replace the Alternate div with the Flash, using swfobject.
-        var flashvars = {
-          id: flashId,
-          width: Drupal.settings.mediaWebcam.flash[flashId].width,
-          height: Drupal.settings.mediaWebcam.flash[flashId].height,
-          connectUrl: Drupal.settings.mediaWebcam.flash[flashId].connectUrl,
-          baseFilename: Drupal.settings.mediaWebcam.flash[flashId].baseFilename,
-          maxDuration: Drupal.settings.mediaWebcam.flash[flashId].maxDuration * 1000,
-          textfield: '#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-red5',
-          stopTimerFunction: 'Drupal.mediaWebcam.stopTimer'
-        };
-        var params = {
-          menu: "false",
-          scale: "noScale",
-          allowFullscreen: "true",
-          allowScriptAccess: "always",
-          bgcolor: "#FFFFFF"
-        };
-        var attributes = {
-          id: flashId
-        };
-        swfobject.embedSWF(Drupal.settings.mediaWebcam.webcamPath, flashId, Drupal.settings.mediaWebcam.flash[flashId].width, Drupal.settings.mediaWebcam.flash[flashId].height, "10.0.0", Drupal.settings.mediaWebcam.expressInstallPath, flashvars, params, attributes);
-      });
-
+  Drupal.behaviors.mediaWebcamAddFlash = {
+    attach: function(context) {
+      for (var flashId in Drupal.settings.mediaWebcam.flash) {
+        // Bind the record & stop buttons to the flash trigger behavior.
+        $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-record:not(.mediaWebcamAddFlash-processed)', context).each(function() {
+          $(this).addClass('mediaWebcamAddFlash-processed')
+            .bind('click', function(e) {
+              Drupal.mediaWebcam.recordClick($(this));
+            })
+            .data('flashId', flashId);
+        });
+        $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-stop:not(.mediaWebcamAddFlash-processed)', context).each(function() {
+          $(this).addClass('mediaWebcamAddFlash-processed')
+            .bind('click', function(e) {
+              Drupal.mediaWebcam.stopClick($(this));
+            })
+            .data('flashId', flashId);
+          $(this).data('red5_textfield', '#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-red5');
+        });
+        $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-play:not(.mediaWebcamAddFlash-processed)', context).each(function() {
+          $(this).addClass('mediaWebcamAddFlash-processed')
+            .bind('click', function(e) {
+              Drupal.mediaWebcam.playClick($(this));
+            })
+            .data('flashId', flashId);
+        });
+        $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-snap:not(.mediaWebcamAddFlash-processed)', context).each(function() {
+          $(this).addClass('mediaWebcamAddFlash-processed')
+            .bind('click', function(e) {
+              Drupal.mediaWebcam.snapClick($(this));
+            })
+            .data('flashId', flashId);
+          $(this).data('red5_snap_textarea', '#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-snap-textarea');
+        });
+        $('#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ':not(.mediaWebcamAddFlash-processed)', context).each(function() {
+          $(this).addClass('mediaWebcamAddFlash-processed');
+  
+          // Replace the Alternate div with the Flash, using swfobject.
+          var flashvars = {
+            id: flashId,
+            width: Drupal.settings.mediaWebcam.flash[flashId].width,
+            height: Drupal.settings.mediaWebcam.flash[flashId].height,
+            connectUrl: Drupal.settings.mediaWebcam.flash[flashId].connectUrl,
+            baseFilename: Drupal.settings.mediaWebcam.flash[flashId].baseFilename,
+            maxDuration: Drupal.settings.mediaWebcam.flash[flashId].maxDuration * 1000,
+            textfield: '#' + Drupal.settings.mediaWebcam.flash[flashId].wrapperId + ' .media-webcam-red5',
+            stopTimerFunction: 'Drupal.mediaWebcam.stopTimer'
+          };
+          var params = {
+            menu: "false",
+            scale: "noScale",
+            allowFullscreen: "true",
+            allowScriptAccess: "always",
+            bgcolor: "#FFFFFF"
+          };
+          var attributes = {
+            id: flashId
+          };
+          swfobject.embedSWF(Drupal.settings.mediaWebcam.webcamPath, flashId, Drupal.settings.mediaWebcam.flash[flashId].width, Drupal.settings.mediaWebcam.flash[flashId].height, "10.0.0", Drupal.settings.mediaWebcam.expressInstallPath, flashvars, params, attributes);
+        });
+  
+      }
     }
   }
 
diff --git a/includes/themes/media-webcam-widget.tpl.php b/includes/themes/media-webcam-widget.tpl.php
index 2e9abb0..033ee3d 100644
--- a/includes/themes/media-webcam-widget.tpl.php
+++ b/includes/themes/media-webcam-widget.tpl.php
@@ -16,7 +16,7 @@
   </div>
 
   <?php if ($buttons) : ?>
-    <div class="media-webcam-buttons">
+    <div class="media-webcam-buttons clearfix">
       <?php print $buttons; ?>
     </div>
   <?php endif; ?>
diff --git a/includes/themes/media_webcam.theme.inc b/includes/themes/media_webcam.theme.inc
index c12c8b5..078a739 100644
--- a/includes/themes/media_webcam.theme.inc
+++ b/includes/themes/media_webcam.theme.inc
@@ -9,7 +9,7 @@
  * Preprocess for theme('media_webcam_widget').
  */
 function template_preprocess_media_webcam_widget(&$variables) {
-  $variables['field'] = content_fields($variables['element']['#field_name'], $variables['element']['#type_name']);
+  $variables['field'] = field_info_instance($variables['element']['#entity_type'], $variables['element']['#field_name'], $variables['element']['#bundle']);
   $variables['no_flash'] = filter_xss_admin(media_webcam_variable_get('no_flash'));
   $id = check_plain($variables['id']);
 
@@ -17,13 +17,13 @@ function template_preprocess_media_webcam_widget(&$variables) {
   $flash_id = $variables['flash_id'] = "mediaWebcamFlash$id";
 
   $variables['button'] = array();
-  if ($variables['field']['widget']['allow_video']) {
-    $variables['button']['record'] = theme('media_webcam_button', 'record', t('Record'));
-    $variables['button']['stop'] = theme('media_webcam_button', 'stop', t('Stop'));
-    $variables['button']['play'] = theme('media_webcam_button', 'play', t('Play'));
+  if ($variables['field']['widget']['settings']['allow_video']) {
+    $variables['button']['record'] = theme('media_webcam_button', array('type' => 'record', 'output' => t('Record')));
+    $variables['button']['stop'] = theme('media_webcam_button', array('type' => 'stop', 'output' => t('Stop')));
+    $variables['button']['play'] = theme('media_webcam_button', array('type' => 'play', 'output' => t('Play')));
   }
-  if ($variables['field']['widget']['allow_snapshot']) {
-    $variables['button']['snap'] = theme('media_webcam_button', 'snap', t('Snap photo'));
+  if ($variables['field']['widget']['settings']['allow_snapshot']) {
+    $variables['button']['snap'] = theme('media_webcam_button', array('type' => 'snap', 'output' => t('Snap Photo')));
   }
 
   $variables['buttons'] = implode("\n", $variables['button']);
diff --git a/media_webcam.info b/media_webcam.info
index 91d868b..55d631a 100644
--- a/media_webcam.info
+++ b/media_webcam.info
@@ -1,7 +1,6 @@
 
 name = Media: Webcam
-description = Provides a Webcam video and image capturing widget to Filefield.
+description = Provides a Webcam video and image capturing widget to file widgets.
 package = "Media"
-core = 6.x
-dependencies[] = content
-dependencies[] = filefield
+core = 7.x
+dependencies[] = file
diff --git a/media_webcam.module b/media_webcam.module
index db91d26..28933e2 100644
--- a/media_webcam.module
+++ b/media_webcam.module
@@ -17,7 +17,7 @@ include_once('includes/media_webcam.variables.inc');
  */
 function media_webcam_menu() {
   return array(
-    'admin/settings/media_webcam' => array(
+    'admin/config/media/media_webcam' => array(
       'title' => 'Media: Webcam',
       'description' => 'Administer the Media: Webcam module.',
       'page callback' => 'drupal_get_form',
@@ -34,13 +34,13 @@ function media_webcam_menu() {
 function media_webcam_theme($existing, $type, $theme, $path) {
   return array(
     'media_webcam_widget' => array(
-      'arguments' => array('element' => array()),
+      'render element' => 'element',
       'file' => 'media_webcam.theme.inc',
       'path' => $path .'/includes/themes',
       'template' => 'media-webcam-widget'
     ),
     'media_webcam_button' => array(
-      'arguments' => array('type' => NULL, 'output' => NULL),
+      'variables' => array('type' => NULL, 'output' => NULL),
       'file' => 'media_webcam.theme.inc',
       'path' => $path .'/includes/themes',
       'template' => 'media-webcam-button'
@@ -49,53 +49,54 @@ function media_webcam_theme($existing, $type, $theme, $path) {
 }
 
 /**
- * Implementation of hook_widget_info().
+ * Implements hook_field_widget_info().
  */
-function media_webcam_widget_info() {
+function media_webcam_field_widget_info() {
   return array(
     'media_webcam' => array(
       'label' => t('Webcam Image & Video Capture'),
-      'field types' => array('filefield', ),
-      'multiple values' => CONTENT_HANDLE_CORE,
-      'callbacks' => array(
-        'default value' => CONTENT_CALLBACK_DEFAULT,
-        ),
+      'field types' => array('file'),
+      'settings' => array(
+        'allow_video' => TRUE,
+        'allow_snapshot' => TRUE
+      )
     ),
   );
 }
 
-function media_webcam_widget_settings($op, $widget) {
-  switch ($op) {
-    case 'form':
-      $form = array();
-      $form['allow_video'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Allow video'),
-        '#description' => t('If checked, then this field will allow for webcam video recordings to be saved locally as .flv files.'),
-        '#default_value' => $widget['allow_video'],
-      );
-      $form['allow_snapshot'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Allow snapshot'),
-        '#description' => t('If checked, then this field will allow for webcam photo snapshots to be saved locally as .jpg files.'),
-        '#default_value' => $widget['allow_snapshot'],
-      );
-      return $form;
-    case 'validate':
-      break;
-    case 'save':
-      $columns = array('allow_video', 'allow_snapshot');
-      return $columns;
+/**
+ * Implements hook_field_widget_settings_form().
+*/
+function media_webcam_field_widget_settings_form($field, $instance) {
+  $widget = $instance['widget'];
+  $settings = $widget['settings'];
+  $form = array();
+
+  if ($widget['type'] == 'media_webcam') {
+    $form['allow_video'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow video'),
+      '#description' => t('If checked, then this field will allow for webcam video recordings to be saved locally as .flv files.'),
+      '#default_value' => $settings['allow_video'],
+    );
+    $form['allow_snapshot'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow snapshot'),
+      '#description' => t('If checked, then this field will allow for webcam photo snapshots to be saved locally as .jpg files.'),
+      '#default_value' => $settings['allow_snapshot'],
+    );
   }
+  return $form;
 }
 
 /**
- * Implementation of hook_widget().
+ * Implements of hook_field_widget_form().
  */
-function media_webcam_widget(&$form, &$form_state, $field, $items, $delta = 0) {
-  switch ($field['widget']['type']) {
+function media_webcam_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
+  $widget = $instance['widget'];
+  switch ($widget['type']) {
     case 'media_webcam':
-      $element = array(
+      $element += array(
         '#type' => 'media_webcam_widget',
         '#default_value' => isset($items[$delta]) ? $items[$delta] : NULL,
       );
@@ -105,7 +106,7 @@ function media_webcam_widget(&$form, &$form_state, $field, $items, $delta = 0) {
 }
 
 /**
- * Implementation of FAPI hook_elements().
+ * Implementation of FAPI hook_element_info().
  *
  * Any FAPI callbacks needed for individual widgets can be declared here,
  * and the element will be passed to those callbacks for processing.
@@ -113,13 +114,13 @@ function media_webcam_widget(&$form, &$form_state, $field, $items, $delta = 0) {
  * Drupal will automatically theme the element using a theme with
  * the same name as the hook_elements key.
  */
-function media_webcam_elements() {
+function media_webcam_element_info() {
   return array(
     'media_webcam_widget' => array(
       '#input' => TRUE,
-      '#columns' => array('fid'), '#delta' => 0,
       '#process' => array('media_webcam_widget_element_process'),
       '#element_validate' => array('media_webcam_widget_element_validate'),
+      '#theme_wrappers' => array('media_webcam_widget'),
     ),
   );
 }
@@ -136,44 +137,43 @@ function media_webcam_widget_element_validate($element, &$form_state) {
  *
  * The $fields array is in $form['#field_info'][$element['#field_name']].
  */
-function media_webcam_widget_element_process($element, $edit, &$form_state, $form) {
+function media_webcam_widget_element_process($element, &$form_state, $form) {
   $field_key = $element['#columns'][0];
-  $field = content_fields($element['#field_name'], $element['#type_name']);
-
+  $instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
+  $field = field_info_field($element['#field_name']);
   $form_element = $element['#field_name'] .'_'. $element['#delta'];
-
+  
   // Save any video that's been uploaded to the Red5 streams folder.
-  if ($field['widget']['allow_video'] && $element['#value']['media_webcam_red5']) {
-    // Create a new file object.
-    $file = new stdClass();
+  if ($instance['widget']['settings']['allow_video'] && !empty($element['#value']['media_webcam_red5'])) {
+    global $user;
 
-    // Set the filename to the returned value.
+    // Borrowed from file_save_upload
+    $file = new stdClass();
+    $file->uid      = $user->uid;
+    $file->status   = 0;
     $file->filename = $element['#value']['media_webcam_red5'] .'.flv';
+    $file->filepath = media_webcam_variable_get('upload_folder') .'/'. $file->filename;
+    $file->uri      = 'file://'. $file->filepath;
     $file->filemime = file_get_mimetype($file->filename);
-
+    $file->filesize = filesize($file->filepath);
+    $file->status = FILE_STATUS_PERMANENT;
+    $file->timestamp = time();
+    
     // The full path + filename where the video resides.
-    $file->filepath = media_webcam_variable_get('upload_folder') .'/'. $file->filename;
-
     // Set the destination path and ensure it exists, creating if necessary.
-    $path = file_directory_path() .'/'. media_webcam_variable_get('file_directory');
-    file_check_directory($path, FILE_CREATE_DIRECTORY);
-
-    // Move the file to the new location.
-    if (file_move($file, $path)) {
-      global $user;
+    $destination = file_field_widget_uri($field, $instance) .'/'. media_webcam_variable_get('file_directory');
+    if (file_prepare_directory($destination, FILE_CREATE_DIRECTORY) && ($file = file_move($file, $destination .'/'. $file->filename))) {
       // Set the other file properties and record the file object.
-      $file->uid = $user->uid;
-      $file->status = FILE_STATUS_TEMPORARY;
-      $file->timestamp = time();
-      $file->filesize = filesize($file->filepath);
-      drupal_write_record('files', $file);
-
+      file_save($file);
       if ($file->fid) {
         // Set the element value to the new fid.
+        $file->display = $file->description = 0;
         $element['#value'] = $element['#default_value'] = (array)$file;
 
         // Ensure the value is saved to filefield.
         $element['#post'][$element['#field_name']][$element['#delta']][$field_key] = $file->fid;
+        $element['#post'][$element['#field_name']][$element['#delta']]['display'] = 0;
+        $element['#post'][$element['#field_name']][$element['#delta']]['description'] = 0;
 
         // Blank out the red5 app value, since we've moved the file.
         $element['#post'][$element['#field_name']][$element['#delta']]['media_webcam_red5'] = '';
@@ -184,15 +184,18 @@ function media_webcam_widget_element_process($element, $edit, &$form_state, $for
       }
     }
   }
-  elseif ($field['widget']['allow_snapshot'] && $element['#value']['media_webcam_snap']) {
+  elseif ($instance['widget']['settings']['allow_snapshot'] && !empty($element['#value']['media_webcam_snap'])) {
     // Save and record the file.
-    $file = media_webcam_save_image($element['#value']['media_webcam_snap'], $form_element);
+    $file = media_webcam_save_image($element['#value']['media_webcam_snap'], $form_element, $field, $instance);
     if ($file->fid) {
       // Set the element value to the new fid.
+      $file->display = $file->description = 0;
       $element['#value'] = $element['#default_value'] = (array)$file;
 
       // Ensure the value is saved to filefield.
       $element['#post'][$element['#field_name']][$element['#delta']][$field_key] = $file->fid;
+      $element['#post'][$element['#field_name']][$element['#delta']]['display'] = 0;
+      $element['#post'][$element['#field_name']][$element['#delta']]['description'] = 0;
 
       // Blank out the red5 app value, since we've moved the file.
       $element['#post'][$element['#field_name']][$element['#delta']]['media_webcam_red5'] = '';
@@ -203,6 +206,10 @@ function media_webcam_widget_element_process($element, $edit, &$form_state, $for
   $element['#attributes']['id'] = $element['#id'] .'-ahah-wrapper';
   $element['#prefix'] = '<div '. drupal_attributes($element['#attributes']) .'>';
   $element['#suffix'] = '</div>';
+  $element['display'] = $element['description'] = array(
+    '#type' => 'value',
+    '#value'=> 0
+  );
   $element[$field_key] = array(
     '#type' => 'value',
     '#value' => isset($element['#default_value']) ? $element['#default_value']['fid'] : '',
@@ -215,11 +222,12 @@ function media_webcam_widget_element_process($element, $edit, &$form_state, $for
     '#required' => $element['#required'],
     '#description' => $element['#description'],
     '#field_name' => $element['#field_name'],
-    '#type_name' => $element['#type_name'],
+    '#bundle' => $element['#bundle'],
+    '#entity_type' => $element['#entity_type'],
     '#delta' => $element['#delta'],
     '#columns' => $element['#columns'],
   );
-  if ($field['widget']['allow_video']) {
+  if ($instance['widget']['settings']['allow_video']) {
     $element['media_webcam_red5'] = array(
       '#type' => 'hidden',
       '#attributes' => array(
@@ -227,7 +235,7 @@ function media_webcam_widget_element_process($element, $edit, &$form_state, $for
       ),
     );
   }
-  if ($field['widget']['allow_snapshot']) {
+  if ($instance['widget']['settings']['allow_snapshot']) {
     $element['media_webcam_snap'] = array(
       '#type' => 'hidden',
       '#attributes' => array(
@@ -241,7 +249,10 @@ function media_webcam_widget_element_process($element, $edit, &$form_state, $for
   return $element;
 }
 
-function media_webcam_save_image($image, $form_element) {
+/**
+ * Util to save the image
+*/
+function media_webcam_save_image($image, $form_element, $field, $instance) {
   $image = str_replace('data:image/jpeg;base64,', '', $image);
   if (!$image) {
     form_set_error($form_element, t('There was a problem uploading your snapshot. Please try again, or contact the site administrator.'));
@@ -252,8 +263,8 @@ function media_webcam_save_image($image, $form_element) {
     if ($base64) {
       if ($directory = media_webcam_variable_get('file_directory')) {
         // Create the opalcanvas folder within the files folder.
-        $path = file_create_path($directory);
-        file_check_directory($path, FILE_CREATE_DIRECTORY);
+        $destination = file_field_widget_uri($field, $instance) .'/'. media_webcam_variable_get('file_directory');
+        file_prepare_directory($path, FILE_CREATE_DIRECTORY);
       }
       // Begin building file object.
       $file = new stdClass();
@@ -263,6 +274,7 @@ function media_webcam_save_image($image, $form_element) {
         global $user;
         $file->uid = $user->uid;
         $file->filename = basename($file->filepath);
+        $file->uri = file_field_widget_uri($field, $instance);
         $file->filemime = file_get_mimetype($file->filename);
         $file->source = 'media_webcam_save_image';
         $file->destination = $file->filepath;
@@ -270,7 +282,7 @@ function media_webcam_save_image($image, $form_element) {
         $file->timestamp = time();
 
         // Note the file is currently saved as a temporary file.
-        drupal_write_record('files', $file);
+        file_save($file);
         return $file;
       }
       else {
