diff --git a/README.txt b/README.txt
index dc6ab5d..6dde107 100644
--- a/README.txt
+++ b/README.txt
@@ -1,41 +1,52 @@
 AudioRecorderField.module
 --------------------------------------------------------------------------------
-The AudioRecorderField.module provides a new CCK field that enables both the recording and playing of .wav audio files directly from the web browser. 
+The AudioRecorderField.module provides a new CCK field that 
+enables both the recording and playing of .wav audio files directly 
+from the web browser. 
 
-The new field is based on AudioField module and records audio via the Nanogong applet (http://gong.ust.hk/nanogong).
+The new field is based on AudioField module and records audio v
+ia the Nanogong applet (http://gong.ust.hk/nanogong).
 
 Installation
 
-1. Extract AudioRecorderField to your sites/all/modules directory. Make sure you have installed CCK, FileField and AudioField modules.
-2. Download Nanogong applet from the following link: http://gong.ust.hk/nanogong/downloads_form.html
-3. Extract the Nanogong archive and copy nanogong.jar file to sites/all/modules/audiorecorderfield/recorders
+1. Extract AudioRecorderField to your sites/all/modules 
+directory. Make sure you have installed CCK, FileField and AudioField modules.
+2. Download Nanogong applet from the following link: 
+http://gong.ust.hk/nanogong/downloads_form.html
+3. Extract the Nanogong archive and copy nanogong.jar 
+file to sites/all/modules/audiorecorderfield/recorders
 4. Enable the AudioRecorderField module in admin/build/modules.
 5. Choose any content type from admin/content/types and go to "manage fields".
-6. Add a new field, select File as its field type and Audio Recorder as the widget.
+6. Add a new field, select File as its field type and Audio 
+Recorder as the widget.
 7. Save.
 8. Create new content and you will see the Nanogong Audio Recorder!
 
 Java player configuration
 
-In order to use the Nanogong applet to play .wav content directly from AudioFields, you should:
-1. Go to admin/content/types and choose the content type that includes the audio field you would like to play with Nanogong
+In order to use the Nanogong applet to play .wav content 
+directly from AudioFields, you should:
+1. Go to admin/content/types and choose the content type 
+that includes the audio field you would like to play with Nanogong
 2. Go to "display fields"
 3. Choose "Audio" for either the "teaser" or the "full node" display modes
-4. Go to admin/settings/audiofield and select the Nanogong player as the default player for .wav files
+4. Go to admin/settings/audiofield and select the Nanogong 
+player as the default player for .wav files
 5. Now you should be all set!
 
 
 FileField Sources support
 
-This module also adds new "recorder" uploading method for FileField Sources module. Its possible to create one field with multiple uploading choices.
+This module also adds new "recorder" uploading method for 
+FileField Sources module. Its possible to create one field 
+with multiple uploading choices.
 1. Download and install FileField Sources module.
 2. Change your Audio Recorder widget to File Upload widget.
-3. Under File Sources fieldset you will see various uploading methods (Audio recorder method is added by this module).
+3. Under File Sources fieldset you will see various uploading 
+methods (Audio recorder method is added by this module).
 
 
 ---
-The AudioRecorderField module has been originally developed by Leo Burd and Tamer Zoubi under the sponsorship of the MIT Center for Future Civic Media (http://civic.mit.edu).
-
-
-
-
+The AudioRecorderField module has been originally developed by 
+Leo Burd and Tamer Zoubi under the sponsorship of the MIT Center 
+for Future Civic Media (http://civic.mit.edu).
diff --git a/audiorecorderfield.info b/audiorecorderfield.info
index 7da7cb5..709c106 100644
--- a/audiorecorderfield.info
+++ b/audiorecorderfield.info
@@ -1,7 +1,5 @@
 name = Audio Recorder Field
 description = Adds a CCK field for recording and playing .wav audio files directly from the browser.
-core = 6.x
+core = 7.x
 dependencies[] = audiofield
 package = CCK
-
-
diff --git a/audiorecorderfield.install b/audiorecorderfield.install
index 84f434c..6a5fd0e 100644
--- a/audiorecorderfield.install
+++ b/audiorecorderfield.install
@@ -1,11 +1,12 @@
 <?php
-// $Id$
+
 /**
  * @file
+ * The $Id$.
  */
- 
+
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function audiorecorderfield_install() {
   drupal_load('module', 'content');
@@ -13,6 +14,9 @@ function audiorecorderfield_install() {
   variable_set('audiofield_audioplayer_wav', 'nanogong');
 }
 
+/**
+ * Implements hook_uninstall().
+ */
 function audiorecorderfield_uninstall() {
   drupal_load('module', 'content');
   content_notify('uninstall', 'audiorecorderfield');
diff --git a/audiorecorderfield.module b/audiorecorderfield.module
index ff5c99b..09ebe7c 100644
--- a/audiorecorderfield.module
+++ b/audiorecorderfield.module
@@ -1,274 +1,305 @@
-<?php
-/**
- * Implementation of hook_init().
- *
- * Load required includes.
- */
-function audiorecorderfield_init() {
-  module_load_include('inc', 'audiorecorderfield', 'audiorecorderfield_widget');
-  module_load_include('inc', 'audiorecorderfield', 'sources/recorder');
-  // Add Javascript settings
-  drupal_add_js(array('audiorecorderfield_path' =>  drupal_get_path('module', 'audiorecorderfield')), 'setting');
-  //Add css
-  drupal_add_css(drupal_get_path('module', 'audiorecorderfield') . '/css/audiorecorderfield.css');
-}
-/**
- * Implementation of hook_menu().
- */
-function audiorecorderfield_menu() {
-  $items['nanogong_file_receive'] = array(
-    'title' => 'nanogong_file_receive',
-    'description' => '',
-    'page callback' => 'nanogong_file_receive',
-    'type' => MENU_CALLBACK,
-    'access callback' => TRUE,
-   );
-   
-   $items['nanogong_preview'] = array(
-    'title' => 'nanogong_preview',
-    'description' => '',
-    'page callback' => 'nanogong_preview',
-    'type' => MENU_CALLBACK,
-    'access callback' => TRUE,
-   );
-   
-   return $items;
-}
-
-/*
- * Nanogong recorder applet callback. This is what happens when 
- * 'upload' is pressed in the applet
- */
-function nanogong_file_receive() {
-  header("Cache-control: private");
-  header("Content-Type: text/plain");
-    
-  $field_id = $_GET['field_id'];
-    
-  //TODO save duration in field
-  //$duration = strip_tags($_POST['duration']);
-  $tmp_name = $_FILES['voicefile']['tmp_name'];
-  $upload_dir = file_directory_path();
-  $c = (file_check_directory($upload_dir, 0)) ? 1:0;
-
-  // TODO: get file extension from real file type
-  $new_name = file_create_filename(time() . '.wav', $upload_dir);
-  $new_path = $upload_dir . $new_name;
-    
-  if ($_FILES['voicefile']['error']>0) {
-    watchdog('audiorecorder_field', "ERROR - error code: " . $_FILES['voicefile']['error']);
-    $fid = "NULL";
-  }
-  else {
-    $_FILES['files'] = $_FILES['voicefile'];
-    $_FILES['files']['name'] = $new_name;
-    foreach ($_FILES['files'] as $key => $value) {
-      $_FILES['files'][$key] = array(0 => $value);
-    }
-
-    if (!$file = file_save_upload(0, NULL, $upload_dir)) {
-      watchdog('audiorecorder_field', "ERROR - file_save_upload failed");
-      $fid = "NULL";
-    } 
-    else {
-      $fid = $file->fid;
-    }
-  }
-  //Return fid to javascript
-  print("$fid"); 
-}
-
-/*Ajax callback function that creates file preview of uploaded file*/
-function nanogong_preview() {
-    $fid=$_GET['fid'];
-    
-    $file=db_fetch_array(db_query("SELECT * FROM {files} WHERE fid=%d", $fid));
-    $preview=theme('filefield_widget_preview', $file);
-    $nanogong_path=base_path() . drupal_get_path('module', 'audiorecorderfield') . '/recorders/nanogong.jar';
-    $audiofile=file_create_url($file['filepath']);
-    $nanogong_id="nanogong-" . $_GET['field_name'] . "-" . $_GET['delta'];
-    $nanogong=audiorecorderfield_nanogong_player($nanogong_path, $audiofile, $nanogong_id);
-    
-    return drupal_json(array('preview' => $preview, 'field_name' => $_GET['field_name'], 'nanogong' => $nanogong, 'delta' => $_GET['delta']));
-    exit();
-}
-
-/**
- * Implementation of hook_elements().
- */
-function audiorecorderfield_elements() {
-  $elements = array();
-  $filefield_elements = filefield_elements();
-  $elements['audiorecorderfield_widget'] = $filefield_elements['filefield_widget'];
-
-  //Process callback to render Nanogong recording applet
-  $elements['audiorecorderfield_widget']['#process'] = array('audiorecorderfield_widget_process');
- // $elements['audiorecorderfield_widget']['#process'] []= 'audiorecorderfield_widget_process';
-  $elements['audiorecorderfield_widget']['#value_callback'] = 'audiorecorderfield_widget_value';
-  return $elements;
-}
-
-/**
- * Implementation of hook_filefield_sources_widgets().
- *
- * This returns a list of widgets that are compatible with FileField Sources.
- */
-function audiorecorderfield_filefield_sources_widgets() {
-  return array('audiorecorderfield_widget');
-}
-
-/**
- * Implementation of hook_filefield_sources_info().
- */
-function audiorecorderfield_filefield_sources_info() {
-  $params = array();
-  $return = array();
-  
-    $function = 'filefield_source_recorder_info';
-    if (function_exists($function)) {
-      $result = call_user_func_array($function, $params);
-      if (isset($result) && is_array($result)) {
-        $return = array_merge_recursive($return, $result);
-      }
-      elseif (isset($result)) {
-        $return[] = $result;
-      }
-    }
-  
-  return $return;
-}
-
-/**
- * Implementation of hook_theme().
- */
-function audiorecorderfield_theme() {
-  $theme= array(
-      'audiorecorderfield_widget' => array(
-      'arguments' => array('element' => NULL),
-      'file' => 'audiorecorderfield_widget.inc',
-      ),
-       //Theme for the players
-       'audiofield_play_wav' => array(
-       'arguments' => array('element' => NULL),
-      ),
-       //Theme for recorder filefield source
-       'filefield_source_recorder_element' => array(
-       'arguments' => array('element' => NULL),
-       'file' => 'sources/recorder.inc',
-      ),
-  );
-
-  return $theme;
-}
-
-/**
- * Implementation of hook_widget_info().
- */
-function audiorecorderfield_widget_info() {
-  return array(
-    'audiorecorderfield_widget' => array(
-      'label' => t('Audio Recorder'),
-      'field types' => array('filefield'),
-      'multiple values' => CONTENT_HANDLE_CORE,
-      'callbacks' => array('default value' => CONTENT_CALLBACK_CUSTOM),
-      'description' => t('Widget for recording audios.'),
-    ),
-  );
-}
-
-/**
- * Implementation of hook_widget_settings().
- */
-function audiorecorderfield_widget_settings($op, $widget) {
-  switch ($op) {
-    case 'form':
-      return audiorecorderfield_widget_settings_form($widget);
-    case 'save':
-      return audiorecorderfield_widget_settings_save($widget);
-  }
-}
-
-/**
- * Implementation of hook_widget().
- * 
- * Assign default properties to item and delegate to audiorecorderfield.
- */
-function audiorecorderfield_widget(&$form, &$form_state, $field, $items, $delta = 0) {
-  // Start with the audiorecorderfield widget as a basic start.
-  // Note that audiorecorderfield needs to modify $form by reference.
-  $element = filefield_widget($form, $form_state, $field, $items, $delta);
-
-  return $element;
-}
-
-/**
- * Implementation of CCK's hook_default_value().
- */
-function audiorecorderfield_default_value(&$form, &$form_state, $field, $delta) {
-  return filefield_default_value($form, $form_state, $field, $delta);
-}
-
-/**
- * Implementation of hook_form_[form_id]_alter().
- *
- * Modify the add new field form to change the default formatter.
- */
-function audiorecorderfield_form_content_field_overview_form_alter(&$form, &$form_state) {
-  $form['#submit'][] = 'audiorecorderfield_form_content_field_overview_submit';
-}
-
-/**
- * Submit handler to set a new field's formatter to "audiofield_embedded".
- */
-function audiorecorderfield_form_content_field_overview_submit(&$form, &$form_state) {
-  if (isset($form_state['fields_added']['_add_new_field']) && isset($form['#type_name'])) {
-    $new_field = $form_state['fields_added']['_add_new_field'];
-    $node_type = $form['#type_name'];
-    $field = content_fields($new_field, $node_type);
-    if ($field['widget']['module'] == 'audiorecorderfield') {
-      foreach ($field['display_settings'] as $display_type => $display_settings) {
-        if ($field['display_settings'][$display_type]['format'] == 'default') {
-          $field['display_settings'][$display_type]['format'] = 'audiofield_embedded';
-        }
-      }
-      content_field_instance_update($field);
-    }
-  }
-}
-
-/**
- * Implementation of hook_audiofield_players().
- */
-function audiorecorderfield_audiofield_players() {
-    $players['nanogong']=array(
-      'path' => drupal_get_path('module', 'audiorecorderfield') . '/recorders/nanogong.jar',
-      'name' => 'Nanogong',
-      'download_link' => 'http://gong.ust.hk/nanogong/downloads_form.html',
-      'filetypes' => array('wav'),
-      'callback' => 'audiorecorderfield_nanogong_player',
-    );
-
-    return $players;
-}
-
-function audiorecorderfield_nanogong_player($player_path, $audio_file, $id="nanogong") {
-    $config = '<param name="ShowSaveButton" value="false" />'; //Disable Save button
-    $config .= '<param name="ShowTime" value="true" /> '; //Show Time
-    $config .= '<param name="ShowRecordButton" value="false" /> '; //Disable Record button
-    $config .= '<param name="ShowSpeedButton" value="false" /> '; //Disable speed button
-    $output='<div class="nanogong-player" id="' . $id . '-wrapper"><applet id="' . $id . '" archive="' . $player_path . '" code="gong.NanoGong" width="82" height="40">  
-            ' . $config . '<param name="SoundFileURL" value="' . $audio_file . '"/> </applet></div>';
-
-    return $output;
-}
-
-function theme_audiofield_play_wav($element) {
-    $config = '<param name="ShowSaveButton" value="false" />'; //Disable Save button
-    $config .= '<param name="ShowTime" value="true" /> '; //Show Time
-    $config .= '<param name="ShowRecordButton" value="false" /> '; //Disable Record button
-    
-    $output='<applet id="nanogong" archive="' . base_path() . drupal_get_path('module', 'audiorecorderfield') . '/recorders/nanogong.jar" code="gong.NanoGong" width="120" height="40">  
-            '. $config . '<param name="SoundFileURL" value="' . base_path() . $element['#item']['filepath'] . '"/></applet>';
-
-    return $output;
-}
\ No newline at end of file
+<?php
+
+/**
+ * @file
+ * Implements hook_init().
+ *
+ * Load required includes.
+ */
+
+/**
+ * Implements hook_init().
+ */
+function audiorecorderfield_init() {
+  module_load_include('inc', 'audiorecorderfield', 'audiorecorderfield_widget');
+  module_load_include('inc', 'audiorecorderfield', 'sources/recorder');
+  // Add Javascript settings.
+  drupal_add_js(array('audiorecorderfield_path' => drupal_get_path('module', 'audiorecorderfield')), 'setting');
+  // Add css.
+  drupal_add_css(drupal_get_path('module', 'audiorecorderfield') . '/css/audiorecorderfield.css');
+}
+
+/**
+ * Implements hook_menu().
+ */
+function audiorecorderfield_menu() {
+  $items['nanogong_file_receive'] = array(
+    'title' => 'nanogong_file_receive',
+    'description' => '',
+    'page callback' => 'nanogong_file_receive',
+    'type' => MENU_CALLBACK,
+    // Accessible true.
+    'access callback' => TRUE,
+  );
+
+  $items['nanogong_preview'] = array(
+    'title' => 'nanogong_preview',
+    'description' => '',
+    'page callback' => 'nanogong_preview',
+    'type' => MENU_CALLBACK,
+    // Accessible true.
+    'access callback' => TRUE,
+  );
+
+  return $items;
+}
+
+/**
+ * Nanogong recorder applet callback.
+ *
+ * This is what happens when 'upload' is pressed in the applet.
+ */
+function nanogong_file_receive() {
+  header("Cache-control: private");
+  header("Content-Type: text/plain");
+
+  $field_id = $_GET['field_id'];
+
+  // @todo save duration in field
+  // $duration = strip_tags($_POST['duration']);.
+  $tmp_name = $_FILES['voicefile']['tmp_name'];
+  $upload_dir = file_directory_path();
+  $c = (file_check_directory($upload_dir, 0)) ? 1 : 0;
+
+  // @todo get file extension from real file type.
+  $new_name = file_create_filename(time() . '.wav', $upload_dir);
+  $new_path = $upload_dir . $new_name;
+
+  if ($_FILES['voicefile']['error'] > 0) {
+    watchdog('audiorecorder_field', "ERROR - error code: " . $_FILES['voicefile']['error']);
+    $fid = "NULL";
+  }
+  else {
+    $_FILES['files'] = $_FILES['voicefile'];
+    $_FILES['files']['name'] = $new_name;
+    foreach ($_FILES['files'] as $key => $value) {
+      $_FILES['files'][$key] = array(0 => $value);
+    }
+
+    if (!$file = file_save_upload(0, NULL, $upload_dir)) {
+      watchdog('audiorecorder_field', "ERROR - file_save_upload failed");
+      $fid = "NULL";
+    }
+    else {
+      $fid = $file->fid;
+    }
+  }
+  // Return fid to javascript.
+  print("$fid");
+}
+
+/**
+ * Ajax callback function that creates file preview of uploaded file.
+ */
+function nanogong_preview() {
+  $fid = $_GET['fid'];
+
+  $file = db_fetch_array(db_query("SELECT * FROM {files} WHERE fid=%d", $fid));
+  $preview = theme('filefield_widget_preview', $file);
+  $nanogong_path = base_path() . drupal_get_path('module', 'audiorecorderfield') . '/recorders/nanogong.jar';
+  $audiofile = file_create_url($file['filepath']);
+  $nanogong_id = "nanogong-" . $_GET['field_name'] . "-" . $_GET['delta'];
+  $nanogong = audiorecorderfield_nanogong_player($nanogong_path, $audiofile, $nanogong_id);
+  return drupal_json(array(
+    'preview' => $preview,
+    'field_name' => $_GET['field_name'],
+    'nanogong' => $nanogong,
+    'delta' => $_GET['delta'],
+  ));
+  exit();
+}
+
+/**
+ * Implements hook_elements().
+ */
+function audiorecorderfield_elements() {
+  $elements = array();
+  $filefield_elements = filefield_elements();
+  $elements['audiorecorderfield_widget'] = $filefield_elements['filefield_widget'];
+
+  // Process callback to render Nanogong recording applet.
+  $elements['audiorecorderfield_widget']['#process'] = array('audiorecorderfield_widget_process');
+  // $elements['audiorecorderfield_widget']['#process'] []
+  // = 'audiorecorderfield_widget_process';
+  $elements['audiorecorderfield_widget']['#value_callback'] = 'audiorecorderfield_widget_value';
+  return $elements;
+}
+
+/**
+ * Implements hook_filefield_sources_widgets().
+ *
+ * This returns a list of widgets that are compatible with FileField Sources.
+ */
+function audiorecorderfield_filefield_sources_widgets() {
+  return array('audiorecorderfield_widget');
+}
+
+/**
+ * Implements hook_filefield_sources_info().
+ */
+function audiorecorderfield_filefield_sources_info() {
+  $params = array();
+  $return = array();
+
+  $function = 'filefield_source_recorder_info';
+  if (function_exists($function)) {
+    $result = call_user_func_array($function, $params);
+    if (isset($result) && is_array($result)) {
+      $return = array_merge_recursive($return, $result);
+    }
+    elseif (isset($result)) {
+      $return[] = $result;
+    }
+  }
+
+  return $return;
+}
+
+/**
+ * Implements hook_theme().
+ */
+function audiorecorderfield_theme() {
+  $theme = array(
+    'audiorecorderfield_widget' => array(
+      'arguments' => array('element' => NULL),
+      'file' => 'audiorecorderfield_widget.inc',
+    ),
+       // Theme for the players.
+    'audiofield_play_wav' => array(
+      'arguments' => array('element' => NULL),
+    ),
+       // Theme for recorder filefield source.
+    'filefield_source_recorder_element' => array(
+      'arguments' => array('element' => NULL),
+      'file' => 'sources/recorder.inc',
+    ),
+  );
+
+  return $theme;
+}
+
+/**
+ * Implements hook_widget_info().
+ */
+function audiorecorderfield_widget_info() {
+  return array(
+    'audiorecorderfield_widget' => array(
+      'label' => t('Audio Recorder'),
+      'field types' => array('filefield'),
+      'multiple values' => CONTENT_HANDLE_CORE,
+      'callbacks' => array('default value' => CONTENT_CALLBACK_CUSTOM),
+      'description' => t('Widget for recording audios.'),
+    ),
+  );
+}
+
+/**
+ * Implements hook_widget_settings().
+ */
+function audiorecorderfield_widget_settings($op, $widget) {
+  switch ($op) {
+    case 'form':
+      return audiorecorderfield_widget_settings_form($widget);
+
+    case 'save':
+      return audiorecorderfield_widget_settings_save($widget);
+  }
+}
+
+/**
+ * Implements hook_widget().
+ *
+ * Assign default properties to item and delegate to audiorecorderfield.
+ */
+function audiorecorderfield_widget(&$form, &$form_state, $field, $items, $delta = 0) {
+  // Start with the audiorecorderfield widget as a basic start.
+  // Note that audiorecorderfield needs to modify $form by reference.
+  $element = filefield_widget($form, $form_state, $field, $items, $delta);
+
+  return $element;
+}
+
+/**
+ * Implements hook_default_value() for CCK.
+ */
+function audiorecorderfield_default_value(&$form, &$form_state, $field, $delta) {
+  return filefield_default_value($form, $form_state, $field, $delta);
+}
+
+/**
+ * Implements hook_form_FORM_ID_alter().
+ *
+ * Modify the add new field form to change the default formatter.
+ */
+function audiorecorderfield_form_content_field_overview_form_alter(&$form, &$form_state) {
+  $form['#submit'][] = 'audiorecorderfield_form_content_field_overview_submit';
+}
+
+/**
+ * Submit handler to set a new field's formatter to "audiofield_embedded".
+ */
+function audiorecorderfield_form_content_field_overview_submit(&$form, &$form_state) {
+  if (isset($form_state['fields_added']['_add_new_field']) && isset($form['#type_name'])) {
+    $new_field = $form_state['fields_added']['_add_new_field'];
+    $node_type = $form['#type_name'];
+    $field = content_fields($new_field, $node_type);
+    if ($field['widget']['module'] == 'audiorecorderfield') {
+      foreach ($field['display_settings'] as $display_type => $display_settings) {
+        if ($field['display_settings'][$display_type]['format'] == 'default') {
+          $field['display_settings'][$display_type]['format'] = 'audiofield_embedded';
+        }
+      }
+      content_field_instance_update($field);
+    }
+  }
+}
+
+/**
+ * Implements hook_audiofield_players().
+ */
+function audiorecorderfield_audiofield_players() {
+  $players['nanogong'] = array(
+    'path' => drupal_get_path('module', 'audiorecorderfield') . '/recorders/nanogong.jar',
+    'name' => 'Nanogong',
+    'download_link' => 'http://gong.ust.hk/nanogong/downloads_form.html',
+    'filetypes' => array('wav'),
+    'callback' => 'audiorecorderfield_nanogong_player',
+  );
+
+  return $players;
+}
+
+/**
+ * {@inheritdoc}
+ */
+function audiorecorderfield_nanogong_player($player_path, $audio_file, $id = "nanogong") {
+  // Disable Save button.
+  $config = '<param name="ShowSaveButton" value="false" />';
+  // Show Time.
+  $config .= '<param name="ShowTime" value="true" /> ';
+  // Disable Record button.
+  $config .= '<param name="ShowRecordButton" value="false" /> ';
+  // Disable speed button.
+  $config .= '<param name="ShowSpeedButton" value="false" /> ';
+  $output = '<div class="nanogong-player" id="' . $id . '-wrapper"><applet id="' . $id . '" archive="' . $player_path . '" code="gong.NanoGong" width="82" height="40">  
+            ' . $config . '<param name="SoundFileURL" value="' . $audio_file . '"/> </applet></div>';
+
+  return $output;
+}
+
+/**
+ * {@inheritdoc}
+ */
+function theme_audiofield_play_wav($element) {
+  // Disable Save button.
+  $config = '<param name="ShowSaveButton" value="false" />';
+  // Show Time.
+  $config .= '<param name="ShowTime" value="true" /> ';
+  // Disable Record button.
+  $config .= '<param name="ShowRecordButton" value="false" /> ';
+
+  $output = '<applet id="nanogong" archive="' . base_path() . drupal_get_path('module', 'audiorecorderfield') . '/recorders/nanogong.jar" code="gong.NanoGong" width="120" height="40">  
+            ' . $config . '<param name="SoundFileURL" value="' . base_path() . $element['#item']['filepath'] . '"/></applet>';
+
+  return $output;
+}
diff --git a/audiorecorderfield_widget.inc b/audiorecorderfield_widget.inc
index cee7759..962ae53 100644
--- a/audiorecorderfield_widget.inc
+++ b/audiorecorderfield_widget.inc
@@ -1,140 +1,138 @@
-<?php
-// $Id:
-
-/**
- * @file
- * audiorecorderfield widget hooks and callbacks.
- */
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'form').
- */
-function audiorecorderfield_widget_settings_form($widget) {
-  $form = module_invoke('filefield', 'widget_settings', 'form', $widget);
-
-  $form['file_extensions'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Permitted upload file extensions'),
-    '#default_value' => is_string($widget['file_extensions']) ? $widget['file_extensions'] :'mp3 wav',
-    '#size' => 64,
-    '#description' => t('Extensions a user can upload to this field. Separate extensions with a space and do not include the leading dot. Leaving this blank will allow users to upload a file with any extension.'),
-    '#weight' => 1,
-  );
-  
-  return $form;
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'save').
- */
-function audiorecorderfield_widget_settings_save($widget) {
-  $filefield_settings = module_invoke('filefield', 'widget_settings', 'save', $widget);
-  return $filefield_settings;
-}
-
-/**
- * Element #value_callback function.
- */
-function audiorecorderfield_widget_value($element, $edit = FALSE) {
-  $field = filefield_widget_value($element, $edit);
-  
-  return $field;
-}
-
-/**
- * FormAPI theme function. Theme the output of an image field.
- */
-function theme_audiorecorderfield_widget($element) {
-  
-  $z=theme('form_element', $element, $element['#children']);
-  
-  return $z;
-}
-
-/**
- * Process an individual element.
- *
- * Build the form element. When creating a form using FAPI #process,
- * note that $element['#value'] is already set.
- *
- * The $fields array is in $form['#field_info'][$element['#field_name']].
- */
-function audiorecorderfield_widget_process($element, $edit, $form_state, $form) {
-  $field = $form['#field_info'][$element['#field_name']];
-  $field_key = $element['#columns'][0];
-  $fid=$element['#value'][$field_key];
-
-  //TODO: Add support for more recording applets (ListenUp,...)
-  //TODO: Add hook_audiofield_recorders to allow other modules to add more recorder applets.
-  $element['applet'] = array(
-    '#required' => $element['#required'],
-    '#value' => audiorecorderfield_recorder_nanogong($element, $field['widget'])
-  );
-     
-  // this would be the hidden field the applet would insert the newly uploaded file fid to.
-  $element[$field_key] = array(
-    '#type' => 'hidden',
-    '#title' => t($field['widget']['label']),
-    '#required' => $element['#required'],
-    '#default_value' => isset($fid) ? $fid : "",
-  );
-
-  return $element;
-}
-
-/*
- * NanoGong recorder applet
- */
-function audiorecorderfield_recorder_nanogong($element, $widget) {
-    // The widget is being presented, so apply the JavaScript.
-    drupal_add_js(drupal_get_path('module', 'audiorecorderfield') . '/js/audiorecorder_nanogong.js');
-    $field_name=str_replace('field_', '', $element['#field_name']);
-    //Change "_" into "-"
-    $field_name=str_replace('_', '-', $field_name);
-    
-    //TODO: Load options here (width, height,MaxDuration...)
-    /*$width = isset($widget['player_width'])?$widget['recorder_width']:300;
-    $height = isset($widget['player_height'])? $widget['recorder_height']:100;
-    */
-    //Nanogong configuration http://gong.ust.hk/nanogong/info_config.html
-    $config = '<param name="ShowSaveButton" value="false" />'; //Disable Save button
-    $config .= '<param name="ShowTime" value="true" /> '; //Show Time
-    $config .= '<param name="ShowSpeedButton" value="false" /> '; //Disable speed button
-    
-    if (!empty($element['#value']['filepath'])) {
-        $info = pathinfo($element['#value']['filename']);
-        $button_op='Remove';
-        $class_suffix='player';
-        $audiofile=file_create_url($element['#value']['filepath']);
-        $op=$info['extension'];
-        if ($op=='wav') {
-          //Load existing file in Nanogong
-          $audio_url = '<param name="SoundFileURL" value="' . $audiofile . '"/>';
-          $config .= '<param name="ShowRecordButton" value="false" /> '; //Disable Record button  
-          $width='82px';
-        }
-        else {
-          $output = '<div id="nanogong-' . $field_name . '-' . $element['#delta'] . '-wrapper">' . audiofield_get_player($audiofile, $op) . '</div>';
-        }
-    }
-    else {
-        $op='wav';
-        $button_op='Upload';
-        $class_suffix='recorder';
-        $width='113px';
-    }
-    
-    //Display Nanogong applet only if there is no file or uploaded file is wav
-    if ($op=='wav') {
-        //Nanogong Applet
-        $output = '<div class="nanogong-' . $class_suffix . '" id="nanogong-' . $field_name . '-' . $element['#delta'] . '-wrapper"><applet id="nanogong-' . $field_name . '-' . $element['#delta'] . '" archive="' . base_path() . drupal_get_path('module', 'audiorecorderfield') . '/recorders/nanogong.jar" 
-            code="gong.NanoGong" width="' . $width . '" height="40">
-            ' . $config . '
-            ' . $audio_url . '
-            </applet></div>';
-    }
-    //Upload/Remove button
-    $output .= '<form><input id="nanogong-button-' . $field_name . '-' . $element['#delta'] . '"type="button" value="' . $button_op . '" onclick="submitVoice(\'' . $field_name . '\',' . $element['#delta'] . ')" /></form>';
-    
-    return $output;
-}
+<?php
+
+/**
+ * @file
+ * Audiorecorderfield widget hooks and callbacks.
+ *
+ * The $Id:.
+ */
+
+/**
+ * Implements hook_widget_settings() for CCK.
+ *
+ * With $op = 'form'.
+ */
+function audiorecorderfield_widget_settings_form($widget) {
+  $form = module_invoke('filefield', 'widget_settings', 'form', $widget);
+  $form['file_extensions'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Permitted upload file extensions'),
+    '#default_value' => is_string($widget['file_extensions']) ? $widget['file_extensions'] : 'mp3 wav',
+    '#size' => 64,
+    '#description' => t('Extensions a user can upload to this field. Separate extensions with a space and do not include the leading dot. Leaving this blank will allow users to upload a file with any extension.'),
+    '#weight' => 1,
+  );
+  return $form;
+}
+
+/**
+ * Implements hook_widget_settings() for CCK.
+ *
+ * With $op = 'save'.
+ */
+function audiorecorderfield_widget_settings_save($widget) {
+  $filefield_settings = module_invoke('filefield', 'widget_settings', 'save', $widget);
+  return $filefield_settings;
+}
+
+/**
+ * Element #value_callback function.
+ */
+function audiorecorderfield_widget_value($element, $edit = FALSE) {
+  $field = filefield_widget_value($element, $edit);
+  return $field;
+}
+
+/**
+ * FormAPI theme function. Theme the output of an image field.
+ */
+function theme_audiorecorderfield_widget($element) {
+  $z = theme('form_element', $element, $element['#children']);
+  return $z;
+}
+
+/**
+ * Process an individual element.
+ *
+ * Build the form element. When creating a form using FAPI #process,
+ * note that $element['#value'] is already set.
+ *
+ * The $fields array is in $form['#field_info'][$element['#field_name']].
+ */
+function audiorecorderfield_widget_process($element, $edit, $form_state, $form) {
+  $field = $form['#field_info'][$element['#field_name']];
+  $field_key = $element['#columns'][0];
+  $fid = $element['#value'][$field_key];
+  // @todo Add support for more recording applets (ListenUp,...)
+  // @todo Add hook_audiofield_recorders to allow other modules to add more recorder applets.
+  $element['applet'] = array(
+    '#required' => $element['#required'],
+    '#value' => audiorecorderfield_recorder_nanogong($element, $field['widget']),
+  );
+  // This would be the hidden field the applet would
+  // insert the newly uploaded file fid to.
+  $element[$field_key] = array(
+    '#type' => 'hidden',
+    '#title' => $field['widget']['label'],
+    '#required' => $element['#required'],
+    '#default_value' => isset($fid) ? $fid : "",
+  );
+  return $element;
+}
+
+/**
+ * NanoGong recorder applet.
+ */
+function audiorecorderfield_recorder_nanogong($element, $widget) {
+  // The widget is being presented, so apply the JavaScript.
+  drupal_add_js(drupal_get_path('module', 'audiorecorderfield') . '/js/audiorecorder_nanogong.js');
+  $field_name = str_replace('field_', '', $element['#field_name']);
+  // Change "_" into "-".
+  $field_name = str_replace('_', '-', $field_name);
+  // @todo Load options here (width, height,MaxDuration...)
+  // $width = isset($widget['player_width'])?$widget['recorder_width']:300;
+  // $height = isset($widget['player_height'])? $widget['recorder_height']:100;
+  // Nanogong configuration http://gong.ust.hk/nanogong/info_config.html
+  // Disable Save button.
+  $config = '<param name="ShowSaveButton" value="false" />';
+  // Show Time.
+  $config .= '<param name="ShowTime" value="true" /> ';
+  // Disable speed button.
+  $config .= '<param name="ShowSpeedButton" value="false" /> ';
+  if (!empty($element['#value']['filepath'])) {
+    $info = pathinfo($element['#value']['filename']);
+    $button_op = 'Remove';
+    $class_suffix = 'player';
+    $audiofile = file_create_url($element['#value']['filepath']);
+    $op = $info['extension'];
+    if ($op == 'wav') {
+      // Load existing file in Nanogong.
+      $audio_url = '<param name="SoundFileURL" value="' . $audiofile . '"/>';
+      // Disable Record button.
+      $config .= '<param name="ShowRecordButton" value="false" /> ';
+      $width = '82px';
+    }
+    else {
+      $output = '<div id="nanogong-' . $field_name . '-' . $element['#delta'] . '-wrapper">' . audiofield_get_player($audiofile, $op) . '</div>';
+    }
+  }
+  else {
+    $op = 'wav';
+    $button_op = 'Upload';
+    $class_suffix = 'recorder';
+    $width = '113px';
+  }
+
+  // Display Nanogong applet only if there is no file or uploaded file is wav.
+  if ($op == 'wav') {
+    // Nanogong Applet.
+    $output = '<div class="nanogong-' . $class_suffix . '" id="nanogong-' . $field_name . '-' . $element['#delta'] . '-wrapper"><applet id="nanogong-' . $field_name . '-' . $element['#delta'] . '" archive="' . base_path() . drupal_get_path('module', 'audiorecorderfield') . '/recorders/nanogong.jar" 
+      code="gong.NanoGong" width="' . $width . '" height="40">
+      ' . $config . '
+      ' . $audio_url . '
+      </applet></div>';
+  }
+  // Upload/Remove button.
+  $output .= '<form><input id="nanogong-button-' . $field_name . '-' . $element['#delta'] . '"type="button" value="' . $button_op . '" onclick="submitVoice(\'' . $field_name . '\',' . $element['#delta'] . ')" /></form>';
+  return $output;
+}
diff --git a/css/audiorecorderfield.css b/css/audiorecorderfield.css
index 3276c9a..c2b4c75 100644
--- a/css/audiorecorderfield.css
+++ b/css/audiorecorderfield.css
@@ -1,12 +1,12 @@
-.nanogong-recorder{
-border:1px solid black;
-height:40px;
-width:113px;
+.nanogong-recorder {
+  border: 1px solid black;
+  height: 40px;
+  width: 113px;
 }
 
 
-.nanogong-player{
-border:1px solid black;
-height:40px;
-width:82px;
-}
\ No newline at end of file
+.nanogong-player {
+  border: 1px solid black;
+  height: 40px;
+  width: 82px;
+}
diff --git a/sources/recorder.inc b/sources/recorder.inc
index 35eb07b..f1b7b0b 100644
--- a/sources/recorder.inc
+++ b/sources/recorder.inc
@@ -1,13 +1,18 @@
 <?php
-// $Id$
 
 /**
  * @file
- * A FileField extension to allow uploading audio files by recording them in Nanogong
+ * The $Id$.
  */
 
 /**
- * Implementation of hook_filefield_source_info().
+ * A FileField extension.
+ *
+ * To allow uploading audio files by recording them in Nanogong.
+ */
+
+/**
+ * Implements hook_filefield_source_info().
  */
 function filefield_source_recorder_info() {
   $source['recorder'] = array(
@@ -22,7 +27,7 @@ function filefield_source_recorder_info() {
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function filefield_source_recorder_theme() {
   return array(
@@ -45,36 +50,37 @@ function filefield_source_recorder_process($element, $edit, &$form_state, $form)
     '#access' => empty($element['fid']['#value']),
   );
 
-  $path = _filefield_source_recorder_directory($field['widget']);
+  // $path = _filefield_source_recorder_directory($field['widget']);
   $description = t('Record audio using Nanogong audio recorder.');
 
   $validators = $element['#upload_validators'];
   if (isset($validators['filefield_validate_size'])) {
-      unset($validators['filefield_validate_size']);
+    unset($validators['filefield_validate_size']);
   }
-  //$description .= '<br />' . filefield_sources_element_validation_help($validators);
-  
+  // $description .= '<br />' .
+  // filefield_sources_element_validation_help($validators);
   $element['filefield_recorder']['#description'] = $description;
- 
   $element['filefield_recorder']['recorder'] = array(
     '#type' => 'submit',
     '#value' => $recorder_message ? t('Refresh') : t('recorder'),
     '#submit' => array('node_form_submit_build_node'),
     '#ahah' => array(
-       'path' => 'filefield/ahah/'. $element['#type_name'] .'/'. $element['#field_name'] .'/'. $element['#delta'],
-       'wrapper' => $element['#id'] .'-ahah-wrapper',
-       'method' => 'replace',
-       'effect' => 'fade',
+      'path' => 'filefield/ahah/' . $element['#type_name'] . '/' . $element['#field_name'] . '/' . $element['#delta'],
+      'wrapper' => $element['#id'] . '-ahah-wrapper',
+      'method' => 'replace',
+      'effect' => 'fade',
     ),
   );
-  
   $element['filefield_recorder']['rec'] = array(
-    '#value' => audiorecorderfield_recorder_nanogong($element, $field['widget'])
+    '#value' => audiorecorderfield_recorder_nanogong($element, $field['widget']),
   );
 
   return $element;
 }
 
+/**
+ * {@inheritdoc}
+ */
 function _filefield_source_recorder_options($path) {
   if (!field_file_check_directory($path, FILE_CREATE_DIRECTORY)) {
     drupal_set_message(t('Specified file recorder path must exist or be writable.'), 'error');
@@ -82,7 +88,9 @@ function _filefield_source_recorder_options($path) {
   }
 
   $options = array();
-  $file_recorder = file_scan_directory($path, '.*', array('.', '..', 'CVS', '.svn'), 0, TRUE, 'filename', 0, 0);
+  $file_recorder = file_scan_directory($path, '.*', array('.',
+    '..', 'CVS', '.svn',
+  ), 0, TRUE, 'filename', 0, 0);
 
   if (count($file_recorder)) {
     $options = array('' => t('-- Select file --'));
@@ -140,15 +148,17 @@ function filefield_source_recorder_value($element, &$item) {
  * Theme the output of the autocomplete field.
  */
 function theme_filefield_source_recorder_element($element) {
- 
   $output = $element['recorder_message']['#value'];
   $output .= $element['rec']['#value'];
   $element['#type'] = 'item';
   return '<div class="filefield-source filefield-source-recorder clear-block">' . theme('form_element', $element, $output) . '</div>';
 }
 
+/**
+ * {@inheritdoc}
+ */
 function _filefield_source_recorder_directory($field, $account = NULL) {
-  $account = isset($account) ? $account : $GLOBALS['user'];  
+  $account = isset($account) ? $account : $GLOBALS['user'];
   $path = $field['filefield_source_recorder_path'];
   $absolute = !empty($field['filefield_source_recorder_absolute']);
 
