diff --git a/APIEXAMPLE/contentanalysisexample.info b/APIEXAMPLE/contentanalysisexample.info
index 0f71df4..553de2f 100644
--- a/APIEXAMPLE/contentanalysisexample.info
+++ b/APIEXAMPLE/contentanalysisexample.info
@@ -1,9 +1,7 @@
-; $Id: contentanalysisexample.info,v 1.5 2010/05/08 16:12:13 tomdude48 Exp $
 name = "Content Analysis API Example"
 description = "Example Content Analyzer module"
 package = Content analysis
 dependencies[] = contentanalysis
-files[] = contentanalysisexample.module
 scripts[] = contentanalysisexample.js
 core = 7.x
 ; Information added by drupal.org packaging script on 2012-02-17
diff --git a/APIEXAMPLE/contentanalysisexample.js b/APIEXAMPLE/contentanalysisexample.js
index 753121a..ee195d4 100644
--- a/APIEXAMPLE/contentanalysisexample.js
+++ b/APIEXAMPLE/contentanalysisexample.js
@@ -1,12 +1,11 @@
-// $Id: contentanalysisexample.js,v 1.5 2010/05/08 16:12:13 tomdude48 Exp $
 (function ($) {
-/*
- * Implementation of hook_contentanalysis_data()
- * Gets the data from the custom fields to attach to the AJAX post data.
- */ 
-var contentanalysisexample_contentanalysis_data = function() {		
-  data = new Array();	
-  data['name'] = document.getElementById('edit-contentanalysisexample-name').value;	
-  return data;
-}
+  /*
+   * Implementation of hook_contentanalysis_data()
+   * Gets the data from the custom fields to attach to the AJAX post data.
+   */
+  var contentanalysisexample_contentanalysis_data = function () {
+    data = new Array();
+    data['name'] = document.getElementById('edit-contentanalysisexample-name').value;
+    return data;
+  }
 })(jQuery);
diff --git a/APIEXAMPLE/contentanalysisexample.module b/APIEXAMPLE/contentanalysisexample.module
index dfa94f0..344dc11 100644
--- a/APIEXAMPLE/contentanalysisexample.module
+++ b/APIEXAMPLE/contentanalysisexample.module
@@ -7,7 +7,7 @@
  */
 
 /**
- *  Implentation of hook_contentanalysis_analyzers()
+ *  Implements hook_contentanalysis_analyzers()
  *  register contentanalysisexample with contentanalysis analyzers registry
  */
 function contentanalysisexample_contentanalysis_analyzers() {
@@ -19,15 +19,15 @@ function contentanalysisexample_contentanalysis_analyzers() {
     'node form submit callback' => 'contentanalysisexample_node_form_submit',
     'weight' => -5,
   );
-  return $analyzers;  
+  return $analyzers;
 }
 
 /**
- * Implementation of hook_analyzer_form_elements() via custom define callback
- * 
- * hook to add any analyzier specific form elements to the content analyzer form. 
+ * Implements hook_analyzer_form_elements().
+ *
+ * hook to add any analyzier specific form elements to the content analyzer form.
  * callback is defined in hook_contentanalysis_analyzers ['form elements callback']
- * 
+ *
  * @param $form_state
  *   Array defined by form_api
  * @param $analysis
@@ -35,19 +35,20 @@ function contentanalysisexample_contentanalysis_analyzers() {
  * @param $node
  *   Node object
  */
-function contentanalysisexample_analyzer_form_elements($form_state, $analysis='', $node=0) {
-  drupal_add_css(drupal_get_path('module', 'contentanalysisexample') . '/contentanalysisexample.css'); 
+function contentanalysisexample_analyzer_form_elements($form_state, $analysis = '', $node = 0) {
+  drupal_add_css(drupal_get_path('module', 'contentanalysisexample') . '/contentanalysisexample.css');
   drupal_add_js(drupal_get_path('module', 'contentanalysisexample') . '/contentanalysisexample.js');
 
   $form['name'] = array(
     '#type' => 'textfield',
     '#title' => t('Whats your name'),
-  ); 
+  );
   return $form;
 }
 
 /**
- * Implementation of hook_node_form_submit() via custom define callback
+ * Implements hook_node_form_submit().
+ *
  * @param $form
  *   Array defined by form_api
  * @param $form_state
@@ -58,11 +59,11 @@ function contentanalysisexample_node_form_submit($form, &$form_state) {
 }
 
 /**
- * Implementation of hook_analyzer() via custom define callback
- * 
- * Performs the analysis. 
+ * Implements hook_analyzer().
+ *
+ * Performs the analysis.
  * callback is defined in hook_contentanalysis_analyzers ['callback']
- * 
+ *
  * @param unknown_type $context
  *   Array context format defined by contentanalysis.module
  * @param unknown_type $analysis
@@ -75,15 +76,15 @@ function contentanalysisexample_analyzer($context, $analysis, $params) {
   $name = $context['inputs']['analyzer_options']['contentanalysisexample']['name'];
   if ($name) {
     $subject = $name;
-    $analysis['messages'][] = contentanalysis_format_message(t('Good job, you submitted your name.'), 'complete'); 
+    $analysis['messages'][] = contentanalysis_format_message(t('Good job, you submitted your name.'), 'complete');
     $analysis['#status'] = 'complete';
-  } 
+  }
   else {
-    $analysis['messages'][] = contentanalysis_format_message(t('Your name was not entered in the options field. Please enter it to make this warning go away.'), 'warning'); 
+    $analysis['messages'][] = contentanalysis_format_message(t('Your name was not entered in the options field. Please enter it to make this warning go away.'), 'warning');
     $analysis['#status'] = 'warning';
   }
   $analysis['content'][] = contentanalysis_format_content('<strong>' . t('Hello ' . $subject) . '</strong>', -5);
-  
+
   return $analysis;
 }
 
diff --git a/contentanalysis.admin.css b/contentanalysis.admin.css
deleted file mode 100644
index f5ef283..0000000
--- a/contentanalysis.admin.css
+++ /dev/null
@@ -1 +0,0 @@
-/* $Id: contentanalysis.admin.css,v 1.1.2.4 2010/06/01 21:23:39 tomdude48 Exp $ */
\ No newline at end of file
diff --git a/contentanalysis.admin.inc b/contentanalysis.admin.inc
index 2486e32..a820d51 100644
--- a/contentanalysis.admin.inc
+++ b/contentanalysis.admin.inc
@@ -1,5 +1,4 @@
 <?php
-// $Id: contentanalysis.admin.inc,v 1.1.2.4 2010/06/01 21:23:39 tomdude48 Exp $
 /**
  * @file * Admin include file. 
 */
@@ -37,18 +36,18 @@
   );
   
   $form['contentanalysis_node_report_display'] = array(    
-    '#type' => 'radios',    
-    '#title' => t('Node edit report style'), 
+    '#type' => 'radios',
+    '#title' => t('Node edit report style'),
     '#options' => $options,
-    '#default_value' => variable_get('contentanalysis_node_report_display', 'both'),     
+    '#default_value' => variable_get('contentanalysis_node_report_display', 'both'),
     '#description' => t('Select the style of report you would like when launching from the node edit form. Dialog is the standard modal report. Inline inserts recommendations directly into the node edit form.')     
   );     
   
   $form['contentanalysis_node_parse_options'] = array(      
     '#type' => 'fieldset',      
     '#title' => t('Node parsing options'),      
-    '#collapsible' => TRUE,      
-    '#collapsed' => TRUE,    
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
   );   
   $form['contentanalysis_node_parse_options']['contentanalysis_node_parse_nodetitle_prepend'] = array(    
     '#type' => 'checkbox',    
@@ -63,17 +62,11 @@
     '#description' => t('If your node title is included on node views, include any formating tags it is enclosed within. Default is &lt;h2&gt;[node_title]&lt;/h2&gt;')     
   );  
   
-  //Add the system buttons to the form
-  $form = system_settings_form($form);  
-
-  
-  //Overide the theme function back to our own one
-  return $form;
+  return system_settings_form($form);
 }
 
 function contentanalysis_admin_analyzer_settings_form() {
-  drupal_set_title(t('Analyzer settings'), PASS_THROUGH);  
-	
+  drupal_set_title(t('Analyzer settings'), PASS_THROUGH);
   $form = contentanalysis_admin_analyzer_settings_element();
   $form['submit'] = array(
     '#type' => 'submit',
@@ -90,21 +83,20 @@ function contentanalysis_admin_analyzer_settings_element($mode = 'global') {
   $analyzer_defs = contentanalysis_analyzer_info();
 
   $settings = variable_get('contentanalysis_analyzer_settings', array());
-//dsm($analyzer_defs);
   $form = array();
   if ($mode == 'global') {
     $form['#tree'] = TRUE;
   }
   foreach ($analyzer_defs AS $name => $def) {
-  	if (isset($def['settings form elements callback'])) {
-	    $form[$name] = array(
-	      '#type' => 'fieldset',
-	      '#title' => $def['title'],
-	      //'#description' => t('Check the below boxes to display widgets in node links by content types.'),
-	      '#collapsible' => TRUE,
-	      '#collapsed' => ($mode == 'global') ? FALSE : TRUE,
-	    );
-	    $setting = isset($settings[$name]) ? $settings[$name] : NULL;
+    if (isset($def['settings form elements callback'])) {
+      $form[$name] = array(
+        '#type' => 'fieldset',
+        '#title' => $def['title'],
+        //'#description' => t('Check the below boxes to display widgets in node links by content types.'),
+        '#collapsible' => TRUE,
+        '#collapsed' => ($mode == 'global') ? FALSE : TRUE,
+      );
+      $setting = isset($settings[$name]) ? $settings[$name] : NULL;
       $form[$name] = array_merge($form[$name], call_user_func($def['settings form elements callback'], $setting, $analyzer_defs[$name]));
     }
   } 
diff --git a/contentanalysis.css b/contentanalysis.css
index 4e569eb..04beba6 100644
--- a/contentanalysis.css
+++ b/contentanalysis.css
@@ -1,5 +1,3 @@
-/* $Id: contentanalysis.css,v 1.1.2.4 2010/06/01 21:23:39 tomdude48 Exp $ */
-
 /*
  * modal dialog box styles
  */
@@ -27,6 +25,7 @@
   -webkit-border-top-left-radius: 0.5em;
   -webkit-border-top-right-radius: 0.5em;
 }
+
 #modalContent div.ctools-modal-content .modal-title {
   font-size: 120%;
   font-weight: bold;
@@ -44,20 +43,24 @@
   padding-left: 1.6em;
   background: url('images/sprite.png') no-repeat -166px -1686px;
 }
+
 #modalContent div.ctools-modal-content a.close img {
   display: none;
 }
+
 /** modal forms CSS **/
 #modalContent div.ctools-modal-content .form-item label {
   width: 100%;
   float: none;
   clear: both;
 }
+
 #modalContent div.ctools-modal-content .resizable-textarea {
   width: 100%;
   margin-left: 0;
   margin-right: 0;
 }
+
 #modalContent div.ctools-modal-content {
   font-size: 12px;
   border: solid 1px #ddd;
@@ -67,6 +70,7 @@
   position: relative;
   display: block;
 }
+
 #modal-content {
   position: relative;
   display: block;
@@ -74,9 +78,10 @@
   height: 100%;
   padding-top: 1em;
 }
+
 #modalBackdrop {
-  position: fixed!important;
-  background-color: #000!important;
+  position: fixed !important;
+  background-color: #000 !important;
 }
 
 /*
@@ -87,38 +92,45 @@ div.analyzers {
   margin-left: -1em;
   float: left;
 }
+
 .page-analysis div.analyzers {
   float: none;
 }
+
 h2.analyzers {
   font-size: 1.5em;
-  color:#5B5B5B;
+  color: #5B5B5B;
   margin-bottom: .5em;
 }
+
 div.analyzers h3.analyzer.active {
- background: #fff url(images/arrow-active.png) no-repeat scroll right center;
- left: 1px;
- position: relative;
+  background: #fff url(images/arrow-active.png) no-repeat scroll right center;
+  left: 1px;
+  position: relative;
 }
+
 div.analyzers h3.analyzer:hover {
   text-decoration: underline;
 }
+
 div.analyzers h3.analyzer {
   cursor: pointer;
-  color:#5B5B5B;
+  color: #5B5B5B;
   font-size: 1.1em;
   font-weight: bold;
   line-height: 2em;
   border-bottom: 1px solid white;
   padding-left: 1em;
-  position:relative;  
+  position: relative;
 }
+
 div.analysis-results {
   margin-top: -33px;
   margin-left: 180px;
   margin-right: 5px;
 }
-div.analysis-results .analyzer-analysis  {
+
+div.analysis-results .analyzer-analysis {
   display: none;
 }
 
@@ -135,23 +147,22 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
  * modal reports section styles
  */
 #modalContent .contentanalysis-report {
-   position: relative;
- }
- 
+  position: relative;
+}
+
 #modalContent .contentanalysis-results {
   position: absolute;
   margin-top: 3px;
   /* border: 2px solid green; */
   float: left;
   clear: left;
-/*  
+  /*
   margin-top: 40px;
   margin-top: 0\9;  /*IE hack
   top: 40px\9;
   */
 }
 
-
 /* tabs */
 
 .contentanalysis-report-tabs {
@@ -165,9 +176,9 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
   -moz-border-radius-topleft: 0.5em;
   -moz-border-radius-topright: 0.5em;
   border-radius-topleft: 0.5em;
-  border-radius-topright: 0.5em;    
+  border-radius-topright: 0.5em;
   /* display: inline; */
-  float: left; 
+  float: left;
   cursor: pointer;
   padding: 3px 10px 2px 10px;
   border: 1px solid #e0e0e0;
@@ -201,17 +212,14 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
 }
 */
 
-
 /* status report table */
 
-
-
 .contentanalysis_stats {
   padding-left: 15px;
 }
 
 .contentanalysis-results table thead {
-  background:#FFFFFF url(images/bg-shade-light.png) repeat-x scroll left bottom;
+  background: #FFFFFF url(images/bg-shade-light.png) repeat-x scroll left bottom;
 }
 
 .contentanalysis-results table thead td:first-child,
@@ -232,6 +240,7 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
   border-spacing: 0px;
   background: #fff;
 }
+
 .contentanalysis-results table .messages {
   border: 0;
   padding: 0;
@@ -245,13 +254,16 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
 .contentanalysis-results table {
   min-width: 100%;
 }
+
 .contentanalysis-results table td.section {
   border-right: 1px solid #e0e0e0;
 }
+
 .contentanalysis-results table tbody tr td {
   border-bottom: 1px solid #e0e0e0;
   /* background-color: #FFFFFF; */
 }
+
 .contentanalysis-results table tbody tr:last-child td {
   border-bottom: 0;
 }
@@ -260,12 +272,11 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
   min-width: 300px;
   padding-right: 15px;
 }
+
 .status_report td:first-child {
   width: 150px;
 }
 
-
-
 #modalContent div.contentanalysis-results h3 {
   font-size: 1.2em;
   font-weight: bold;
@@ -282,9 +293,9 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
   font-size: 100%;
 }
 
-.contentanalysis_analysis h3 {  
-  padding: 0 5px 0 5px;  
-  margin: 0 0 0 0; 
+.contentanalysis_analysis h3 {
+  padding: 0 5px 0 5px;
+  margin: 0 0 0 0;
 }
 
 .contentanalysis_stats {
@@ -293,28 +304,29 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
   background: #fff;
 }
 
-.analysis-results pre {  
-  padding: 0 5px 0 5px;  
-  background-color: #FFFFFF; 
+.analysis-results pre {
+  padding: 0 5px 0 5px;
+  background-color: #FFFFFF;
 }
 
 /* Status Report */
 
-.analysis-results .status_report .sections {  
+.analysis-results .status_report .sections {
   width: 120px;
 }
 
-.analysis-results .status_report .section {  
+.analysis-results .status_report .section {
   text-align: center;
 }
-.analysis-results .status_report .messages .status, 
-.analysis-results .status_report .messages .complete, 
+
+.analysis-results .status_report .messages .status,
+.analysis-results .status_report .messages .complete,
 .analysis-results .status_report .messages .pass,
-.analysis-results .status_report .messages .warning, 
-.analysis-results .status_report .messages .error {  
-  padding-left: 50px;  
-  background-repeat: no-repeat;  
-  background-position: 15px center;  
+.analysis-results .status_report .messages .warning,
+.analysis-results .status_report .messages .error {
+  padding-left: 50px;
+  background-repeat: no-repeat;
+  background-position: 15px center;
   min-height: 16px;
   list-style-image: none;
   list-style-type: none;
@@ -322,86 +334,85 @@ div.page-analysis div.analysis-results .analyzer-analysis  {
 
 /* inline report styling */
 fieldset.contentanalysis_section_analysis {
-	padding: 0 0 0 0;
+  padding: 0 0 0 0;
 }
 
 fieldset.contentanalysis_section_analysis .fieldset-legend {
-	position: static;
+  position: static;
 }
 
 /* fix to work with admin theme */
 
-#content .analysis-results .status_report .messages li.status, 
-#content .analysis-results .status_report .messages li.complete, 
+#content .analysis-results .status_report .messages li.status,
+#content .analysis-results .status_report .messages li.complete,
 #content .analysis-results .status_report .messages li.pass,
-#content .analysis-results .status_report .messages li.warning, 
-#content .analysis-results .status_report .messages li.error {  
-  padding-left: 50px;  
-  background-repeat: no-repeat;  
-  background-position: 15px center;  
+#content .analysis-results .status_report .messages li.warning,
+#content .analysis-results .status_report .messages li.error {
+  padding-left: 50px;
+  background-repeat: no-repeat;
+  background-position: 15px center;
   min-height: 16px;
 }
 
-
-.analysis-results .status_report li {  
-  margin: 0;  
-  padding: 5px 0;  
+.analysis-results .status_report li {
+  margin: 0;
+  padding: 5px 0;
   line-height: 140%;
 }
 
-#content .contentanalysis_analysis .status_report ul li {  
-  list-style: none outside none;  
+#content .contentanalysis_analysis .status_report ul li {
+  list-style: none outside none;
   margin-left: 0px;
 }
 
-#modal-content .contentanalysis-results .status_report ul li {  
-  list-style: none outside none;  
+#modal-content .contentanalysis-results .status_report ul li {
+  list-style: none outside none;
   margin-left: 0px;
 }
 
-.analysis-results .status_report .status {  
-  color: #333333; 
-  background-color: #FFFFFF;	
+.analysis-results .status_report .status {
+  color: #333333;
+  background-color: #FFFFFF;
 }
 
-.analysis-results .status_report .messages .status {  
-  background-color: #FFFFFF;	
+.analysis-results .status_report .messages .status {
+  background-color: #FFFFFF;
 }
 
-.analysis-results .status_report .complete {  
-  color: #333333;  
-  background-color: #DDFFAA;  
+.analysis-results .status_report .complete {
+  color: #333333;
+  background-color: #DDFFAA;
 }
 
-.analysis-results .status_report .messages .complete {  
+.analysis-results .status_report .messages .complete {
   background-image: url('icons/complete.png');
 }
 
-.analysis-results .status_report .pass {  
-  color: #333333;  
-  background-color: #DDFFAA;  
+.analysis-results .status_report .pass {
+  color: #333333;
+  background-color: #DDFFAA;
 }
 
-.analysis-results .status_report .messages .pass {  
+.analysis-results .status_report .messages .pass {
   background-image: url('icons/pass.png');
 }
 
-.analysis-results .status_report .warning {  
-  color: #333333;  
-  background-color: #FFFFCC;	
+.analysis-results .status_report .warning {
+  color: #333333;
+  background-color: #FFFFCC;
 }
 
-.analysis-results .status_report .messages .warning {  
-  background-image: url('icons/warning.png');  
+.analysis-results .status_report .messages .warning {
+  background-image: url('icons/warning.png');
 }
 
-.analysis-results .status_report .error {  
-  color: #333333;  
-  background-color: #FFCCCC;  
+.analysis-results .status_report .error {
+  color: #333333;
+  background-color: #FFCCCC;
 }
 
-.analysis-results .status_report .messages .error {  
-  background-image: url('icons/error.png');  
+.analysis-results .status_report .messages .error {
+  background-image: url('icons/error.png');
 }
 
 /* button styling */
@@ -412,42 +423,45 @@ a.contentanalysis-button {
 }
 
 .contentanalysis-button {
-  text-shadow:0 1px 0 #FFFFFF;
-  -moz-border-radius:11px 11px 11px 11px;
-  -moz-box-sizing:content-box;
-  border-style:solid;
-  border-width:1px;
-  cursor:pointer;
-  font-size:11px !important;
-  line-height:14px;
-  padding:2px 8px;
-  text-decoration:none;
+  text-shadow: 0 1px 0 #FFFFFF;
+  -moz-border-radius: 11px 11px 11px 11px;
+  -webkit-border-radius: 11px 11px 11px 11px;
+  -o-border-radius: 11px 11px 11px 11px;
+  -moz-box-sizing: content-box;
+  -webkit-box-sizing: content-box;
+  -o-box-sizing: content-box;
+  border-style: solid;
+  border-width: 1px;
+  cursor: pointer;
+  font-size: 11px !important;
+  line-height: 14px;
+  padding: 2px 8px;
+  text-decoration: none;
 }
 
 .contentanalysis-button:active {
-  background:url("images/white-grad-active.png") repeat-x scroll left top #EEEEEE;
+  background: url("images/white-grad-active.png") repeat-x scroll left top #EEEEEE;
 }
 
 .contentanalysis-button:hover {
-  /* border-color:#666666; */
-  color:#FF4444;
+  color: #FF4444;
 }
 
 .contentanalysis-button:active,
 .contentanalysis-button:focus {
-  color:#FF4444;
+  color: #FF4444;
 }
 
 /* analyzer form cleanup */
 #edit-contentanalysis fieldset {
-  position: static;	
+  position: static;
 }
 
 /**
  * slider styling
  */
 .ui-slider {
-  width:400px;
+  width: 400px;
 }
 
 /* @end */
diff --git a/contentanalysis.info b/contentanalysis.info
index 08f6295..e259234 100644
--- a/contentanalysis.info
+++ b/contentanalysis.info
@@ -1,12 +1,7 @@
-; $Id: contentanalysis.info,v 1.1.2.4 2010/06/01 21:23:39 tomdude48 Exp $
-name = "Content Analysis API"
-description = "Provides an API for content analyzers"
+name = Content Analysis API
+description = Provides an API for content analyzers
 package = Content analysis
 dependencies[] = ctools
-files[] = contentanalysis.admin.inc
-files[] = contentanalysis.install
-files[] = contentanalysis.module
-files[] = contentanalysis.css
 scripts[] = contentanalysis.js
 
 core = 7.x
diff --git a/contentanalysis.install b/contentanalysis.install
index a9f1faa..fc4f191 100644
--- a/contentanalysis.install
+++ b/contentanalysis.install
@@ -1,30 +1,15 @@
 <?php
-// $Id: contentanalysis.install,v 1.1.2.5 2010/09/26 00:32:57 tomdude48 Exp $
 /**
  * @file 
  * Install include file. Implements database schema. 
 */
 
 /**
- *  Implementation of hook_install().
- */
-function contentanalysis_install() {
-  drupal_set_message(st('Content Analysis has been installed.')); 
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function contentanalysis_uninstall() {
-  drupal_set_message(st('Content Analysis has been uninstalled.'));  
-}
-
-/**
- *  Implementation of hook_schema()
+ *  Implements hook_schema().
  */
 function contentanalysis_schema() {
   $schema['contentanalysis'] = array(
-    'description' => ('Creates database table for content analysis settings.'),
+    'description' => 'Creates database table for content analysis settings.',
     'fields' => array(
       'aid' => array(
         'type' => 'serial',
@@ -77,7 +62,7 @@ function contentanalysis_schema() {
 
   ); 
   $schema['contentanalysis_status'] = array(
-    'description' => ('Creates database table for content analysis settings.'),
+    'description' => 'Creates database table for content analysis settings.',
     'fields' => array(
       'aid' => array(
         'type' => 'int',
@@ -113,63 +98,3 @@ function contentanalysis_schema() {
   ); 
   return $schema;
 }
-
-/** previous schema for testing
-
-function contentanalysis_schema() {
-  $schema['contentanalysis'] = array(
-    'description' => t('Creates database table for content analysis settings.'),
-    'fields' => array(
-      'aid' => array(
-        'type' => 'serial',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'description' => 'The id for the analysis.',  
-      ), //aid
-      'last_analysis' => array(
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0,
-        'description' => 'The unix timestamp of the time the analysis was last run.',  
-      ), //last_analysis
-      'nid' => array(
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0,
-        'description' => 'The {node}.nid of an analyzed node.',  
-      ), //nid
-      'path' => array(
-        'type' => 'varchar',
-        'length' => '255',
-        'not null' => TRUE,
-        'default' => '',
-        'description' => 'Drupal path of an analyzed page.',  
-      ), //path  
-      'url' => array(
-        'type' => 'varchar',
-        'length' => '255',
-        'not null' => TRUE,
-        'default' => '',
-        'description' => 'URL of an analyzed page.',  
-      ), //url 
-      'analyzers' => array(
-        'type' => 'varchar',
-        'length' => '255',
-        'not null' => TRUE,
-        'default' => '',
-        'description' => 'Analyzers to use with node.',  
-      ), //analyzers                        
-    ),
-    'primary key' => array('aid'),
-    'indexes' => array(
-      'nid' => array('nid'),
-      'path' => array('path'),
-      'url' => array('url'),
-    ),
-
-  ); 
-  return $schema;
-}
-//*/
diff --git a/contentanalysis.js b/contentanalysis.js
index 1df3def..8a68dfa 100644
--- a/contentanalysis.js
+++ b/contentanalysis.js
@@ -1,356 +1,350 @@
-// $Id: contentanalysis.js,v 1.1.2.7 2010/11/09 21:50:14 tomdude48 Exp $
 var contentanalysis = contentanalysis || {};
 
 (function ($, $$) {
-	$.extend($$, {
-		contentanalysisPrevAnalyzerTab: '',
-		contentanalysisPrevReportTab: '',
-		contentanalysisCurrentAnalyzerTab: '',
-		contentanalysisCurrentReportTab: '',
-		contentanalysisReportActiveTab: {},
-		
-		init: function() {
-			$$.contentanalysis_contentanalysisui();
-		},
-		
-		contentanalysis_contentanalysisui: function() {
-		    if($('#modalContent div.analyzers h3.analyzer').size() > 0) {
-		        $$.contentanalysis_show_analyzer_tab($('div.analyzers h3.analyzer').get(0));
-		        $('div.analyzers h3.analyzer').mousedown(function () {
-		        	$$.contentanalysis_show_analyzer_tab(this);
-		        }) 
-		        $('h3.contentanalysis-report-tab').mousedown(function () { 
-		        	$$.contentanalysis_show_report_tab(this);
-		        })
-		    }	
-		},
+  $.extend($$, {
+    contentanalysisPrevAnalyzerTab:'',
+    contentanalysisPrevReportTab:'',
+    contentanalysisCurrentAnalyzerTab:'',
+    contentanalysisCurrentReportTab:'',
+    contentanalysisReportActiveTab:{},
 
-		contentanalysis_back: function() {
-			$$.contentanalysis_show_analyzer_tab(contentanalysisPrevAnalyzerTab);
-		  //contentanalysis_show_report_tab(contentanalysisPrevReportTab);
-		},
+    init:function () {
+      $$.contentanalysis_contentanalysisui();
+    },
 
-		contentanalysis_show_analyzer_tab: function (theTab){
-		  $('div.analysis-results div.analyzer-analysis:eq(' + $('.analyzers h3.analyzer').index(theTab) + ')').children('.content-analysis-tab:first').addClass('active');
-		  $('div.analysis-results div.analyzer-analysis').hide();
-		  $('.analyzers h3.analyzer').removeClass('active');
-		  $(theTab).addClass('active');
-		  $('div.analysis-results div.analyzer-analysis:eq(' + $('.analyzers h3.analyzer').index(theTab) + ')').show();
-		  $('.content-analysis-results').hide();
-		
-		  var id = $(theTab).attr('id');
-		  var e = id.split('-');
-		  var analyzer = e[3];
-		  
-		  if($$.contentanalysisReportActiveTab[analyzer]) {
-		    $$.contentanalysis_show_report_tab($('#contentanalysis-report-tab-' + analyzer + '-' + $$.contentanalysisReportActiveTab[analyzer]));
-		  }
-		  else {
-		    $$.contentanalysis_show_report_tab($('#contentanalysis-report-tab-' + analyzer + '-0'));
-		  }
-		  $$.contentanalysisPrevAnalyzerTab = $$.contentanalysisCurrentAnalyzerTab;
-		  $$.contentanalysisCurrentAnalyzerTab = theTab;  
-		},
+    contentanalysis_contentanalysisui:function () {
+      if ($('#modalContent div.analyzers h3.analyzer').size() > 0) {
+        $$.contentanalysis_show_analyzer_tab($('div.analyzers h3.analyzer').get(0));
+        $('div.analyzers h3.analyzer').mousedown(function () {
+          $$.contentanalysis_show_analyzer_tab(this);
+        })
+        $('h3.contentanalysis-report-tab').mousedown(function () {
+          $$.contentanalysis_show_report_tab(this);
+        })
+      }
+    },
 
-		contentanalysis_show_report_tab: function (theTab){
-		  var id = $(theTab).attr('id');
-		  var e = id.split('-');
-		  $$.contentanalysisReportActiveTab[e[3]] = e[4];
-		  $('h3.contentanalysis-report-tab').removeClass('active');  
-		  $(theTab).addClass('active');
-		  $('.contentanalysis-results-section').hide();
-		
-		  var tabs = $("#contentanalysis-report-tabs-" + e[3]);
-		  //tabs.css('border','2px solid red');
-		  var pos = $("#contentanalysis-report-tabs-" + e[3]).position(); 
-		  var offset = $("#contentanalysis-report-tabs-" + e[3]).offset(); 
-		  var height = tabs.height();
-		  var top = (pos.top+height)+"px";
-		  var left = (pos.left)+"px";
-		  
-		  var sec_id = id.replace('tab', 'results');
-		  var result_id = sec_id.replace('-'+e[4],'')
-		  //$('#' + result_id).css({'top': top, 'left': left}); 
-		  $('#' + result_id).css('top', top); 
-		  //$('#' + result_id).css('border', '2px solid green'); 
-		  $('#' + sec_id).show();
-		//alert("pos.left="+pos.left+",pos.top="+pos.top+",offset.left="+offset.left+",offset.top="+offset.top);
-		  $$.contentanalysisPrevReportTab = $$.contentanalysisCurrentReportTab;
-		  $$.contentanalysisCurrentReportTab = theTab; 
-		},
+    contentanalysis_back:function () {
+      $$.contentanalysis_show_analyzer_tab(contentanalysisPrevAnalyzerTab);
+    },
 
-		// called from inline Analyze content button
-		contentanalysis_inline_analysis: function() {
-		  Drupal.settings.contentanalysis.display_dialog = 0;
-		  Drupal.settings.contentanalysis.display_inline = 1;
-		  //$('#contentanalysis-ininline-analysis-button').after('<span class="throbber">Loading...</span>');
-		  //$('#contentanalysis-ininline-analysis-button').after(Drupal.settings.contentanalysis.throbber);
-		  $('#contentanalysis-buttons').after('<div class="ahah-progress ahah-progress-throbber"><div class="throbber">&nbsp;</div><div class="message">' + Drupal.t('Analyzing...') + '</div></div>');
-		  $$.contentanalysis_analyze();
-		},
+    contentanalysis_show_analyzer_tab:function (theTab) {
+      $('div.analysis-results div.analyzer-analysis:eq(' + $('.analyzers h3.analyzer').index(theTab) + ')').children('.content-analysis-tab:first').addClass('active');
+      $('div.analysis-results div.analyzer-analysis').hide();
+      $('.analyzers h3.analyzer').removeClass('active');
+      $(theTab).addClass('active');
+      $('div.analysis-results div.analyzer-analysis:eq(' + $('.analyzers h3.analyzer').index(theTab) + ')').show();
+      $('.content-analysis-results').hide();
 
-		// called from inline Analyze content button
-		contentanalysis_dialog_analysis: function() {
-		  Drupal.settings.contentanalysis.display_dialog = 1;
-		  Drupal.settings.contentanalysis.display_inline = 0;
-		  $$.contentanalysis_analyze();
-		},
+      var id = $(theTab).attr('id');
+      var e = id.split('-');
+      var analyzer = e[3];
 
-		// called from inline Analyze content button
-		contentanalysis_full_analysis: function() {
-		  Drupal.settings.contentanalysis.display_dialog = 1;
-		  Drupal.settings.contentanalysis.display_inline = 1;
-		  
-		  $$.contentanalysis_analyze();
-		},
+      if ($$.contentanalysisReportActiveTab[analyzer]) {
+        $$.contentanalysis_show_report_tab($('#contentanalysis-report-tab-' + analyzer + '-' + $$.contentanalysisReportActiveTab[analyzer]));
+      }
+      else {
+        $$.contentanalysis_show_report_tab($('#contentanalysis-report-tab-' + analyzer + '-0'));
+      }
+      $$.contentanalysisPrevAnalyzerTab = $$.contentanalysisCurrentAnalyzerTab;
+      $$.contentanalysisCurrentAnalyzerTab = theTab;
+    },
 
-		// called from inline Analyze content button
-		contentanalysis_refresh_analysis: function(analyzer) {
-		  Drupal.settings.contentanalysis.display_dialog = 0;
-		  Drupal.settings.contentanalysis.display_inline = 1;
-		  //$('.contentanalysis-refresh-link-' + analyzer).replaceWith('<span class="throbber">Loading...</span>');
-		  $('.contentanalysis-refresh-link-' + analyzer).replaceWith('<div class="ahah-progress ahah-progress-throbber"><div class="throbber">&nbsp;</div></div>');
-		  $$.contentanalysis_analyze(analyzer);
-		},
+    contentanalysis_show_report_tab:function (theTab) {
+      var id = $(theTab).attr('id');
+      var e = id.split('-');
+      $$.contentanalysisReportActiveTab[e[3]] = e[4];
+      $('h3.contentanalysis-report-tab').removeClass('active');
+      $(theTab).addClass('active');
+      $('.contentanalysis-results-section').hide();
 
-		contentanalysis_analyze: function(analyzer_override) {
-		  // if TinyMCE is used, turn off and on to save body text to textarea
-		  var data = { 
-		    'nid': -1,
-		    'node_type': -1,
-		    'source': -1,
-		    'analyzers':-1,
-		    'title': -1, 
-		    'body': -1,
-		    'body_summary': -1,
-		    'page_title':-1, 
-		    'meta_title':-1,
-		    'meta_keywords':-1, 
-		    'meta_description':-1,
-		    'path_alias': -1,
-		    'path_pathauto': -1,
-		    'url': -1,
-		    'page': -1,
-		    'body_input_filter': -1,
-		    'hidden': -1,    
-		    'code': Drupal.settings.contentanalysis.code,
-		    'action': -1
-		  };
-		  if(analyzer_override) {
-		    data.action = 'refresh';
-		  }
-		  if ($('#contentanalysis-page-analyzer-form').html()) {
-		    data.source = 'admin-form';
-		    data.body = $('[name=input]').val()
-		    data.nid = $('[name=input_nid]').val()
-		    data.url = $('[name=input_url]').val()
-		    if(data.body == '') {
-		      data.body = -1;
-		    }
-		    if(data.nid == '') {
-		      data.nid = -1;
-		    }
-		    if(data.url == '') {
-		      data.url = -1;
-		    }    
-		  } else if ($('.node-form').html()) {
-		    data.source = 'node-edit-form';
-		    // Turn off TinyMCE if enabled
-		    if(typeof tinyMCE == 'object') {
-		    	tinyMCE.get('edit-body-und-0-value').hide();
-		    }
-		    // Turn off CKEditor if any.
-		    var ckeditor = false;
-		    if ($('#cke_edit-body-und-0-value').html()) {
-		      $('#wysiwyg-toggle-edit-body-und-0-value').click();
-		      ckeditor = true;
-		    }
-		
-		    data.title = $('#edit-title').val();
-		    data.body = $('#edit-body-und-0-value').val();
-		    if ($('#edit-body-und-0-summary').val() != null) {
-		      data.body_summary = $('#edit-body-und-0-summary').val();
-		    } 
-		    data.nid = Drupal.settings.contentanalysis.nid
-		    data.node_type = Drupal.settings.contentanalysis.node_type
-		    data.body_input_filter = $("select[name='body[und][0][format]'] option:selected").val();
-		    
-		    if ($('#edit-page-title').val() != null) {
-		      data.page_title = $('#edit-page-title').val();
-		    }    
-		    // check if metatag module fields exist
-		    if ($('#edit-metatags-title-value').val() != null) {
-		      data.meta_title = $('#edit-metatags-title-value').val();
-		    }
-		    if ($('#edit-metatags-keywords-value').val() != null) {
-		      data.meta_keywords = $('#edit-metatags-keywords-value').val();
-		    }
-		    if ($('#edit-metatags-description-value').val() != null) {
-		      data.meta_description = $('#edit-metatags-description-value').val();
-		    }
-		    if ($('#edit-path-alias').val() != null) {
-		      data.url = window.location.host + Drupal.settings.contentanalysis.base_path + $('#edit-path-alias').val();
-		      data.path_alias = $('#edit-path-alias').val();
-		    }
-		    if ($("input[name='path[pathauto]']:checked").val() != null) {
-		    	data.path_pathauto = 1;
-		    }
-		    // Turn back on tinyMCE
-		    if(typeof tinyMCE == 'object') {
-		    	tinyMCE.get('edit-body-und-0-value').show();
-		    }	
-		    // Turn back on CKEditor if needed.
-		    if (ckeditor) {
-		      $('#wysiwyg-toggle-edit-body-und-0-value').click();
-		    }
-		
-		  } else {
-		    data.source = 'page-link';
-		    data.page = $('html').html()  
-		    data.url = window.location.href
-		  }
-		  if(Drupal.settings.contentanalysis.hidden != null) {
-		    data.hidden = Drupal.settings.contentanalysis.hidden;
-		  }
-		  
-		  //alert('data.nid ' + data.nid)
-		  var analyzers_arr = new Array();
-		  if(analyzer_override) {
-		    data.analyzers = analyzer_override;
-		    analyzers_arr[0] = data.analyzers; 
-		  }
-		  else if($('#contentanalysis_analyzers_override input').val() != null) {    
-		    data.analyzers = $('#contentanalysis_analyzers_override input').val();
-		    analyzers_arr[0] = data.analyzers;
-		  } 
-		  else {
-		    var i = 0;
-		    $('#contentanalysis_analyzers .form-checkbox:checked').each ( function () {  
-		      var expr = new RegExp(/\[[^\]]+\]/);
-		      analyzers_arr[i] = expr.exec($(this).attr('name'))[0].replace(']', '').replace('[','');    
-		      i++;
-		    })
-		    data.analyzers = analyzers_arr.join(',');
-		  }
-		  // call contentanalysis_data for enabed analyzers
-		  for(var i in analyzers_arr) {
-		    var aid = analyzers_arr[i];
-		    var module = Drupal.settings.contentanalysis.analyzer_modules[aid].module;
-		    if (eval('typeof ' + module + '_contentanalysis_data == "function"')) {
-		      d = eval(module + '_contentanalysis_data')(aid, data);
-		      for(var k in d) {
-		        eval('data.ao_'+aid+'_'+k+' = "'+d[k]+'";');
-		      }
-		    }
-		  }  
-		  $('#contentanalysis-buttons').hide(); 
-		  $.ajax({
-		    type: 'POST',
-		    url: Drupal.settings.contentanalysis.analyze_callback,
-		    data: data,
-		    dataType: 'json',
-		    success: function(data, textStatus) {
-		      analyzers_arr = data.inputs['analyzers'].split(",");
-		      if(Drupal.settings.contentanalysis.display_dialog == 1) {
-		        $('#analysis-modal').append(data.main['output']);
-		        $('#analysis-modal .progress').remove();
-		        //Drupal.behaviors.contentanalysisui();
-		        $$.contentanalysis_contentanalysisui()
-		      }
-		      // display inline if enabled
-		      if(Drupal.settings.contentanalysis.display_inline == 1) {
-		        if(data.inputs['action'] == 'refresh') {
-		          //if($('.contentanalysis_section_analysis').length > 0)
-		          for(i in analyzers_arr) {
-		            aid = analyzers_arr[i];
-		            $('.contentanalysis-report-'+aid+'-page_title').replaceWith(data.page_title['output']);
-		            $('.contentanalysis-report-'+aid+'-body').replaceWith(data.body['output']);
-		            $('.contentanalysis-report-'+aid+'-meta_description').replaceWith(data.meta_description['output']);
-		            $('.contentanalysis-report-'+aid+'-meta_keywords').replaceWith(data.meta_keywords['output']);
-		          }
-		        }
-		        else {
-		          var show_title = true;
-		          if($('.form-item-metatags-title-value').length > 0) {
-		            $('.form-item-metatags-title-value > .contentanalysis_section_analysis').remove();
-		            $('.form-item-metatags-title-value').append(data.page_title['output']);
-		            // check if metatag-title contains [node:title] token
-		            if ($('#edit-metatags-title-value').val() != null) {
-		              var meta_title = $('#edit-metatags-title-value').val();
-		              if(meta_title.indexOf("[node:title]") == -1) {
-		            	//show_title = false;
-		              }
-		            }
-		          } 
-		          if (show_title) {
-		            $('.form-item-title > .contentanalysis_section_analysis').remove();
-		            $('.form-item-title').append(data.page_title['output']);				
-		          }
-		    
-		          $('#edit-body > .contentanalysis_section_analysis').remove();
-		          $('#edit-body').append(data.body['output']);
-		          // check newer nodewords format
-		          if(($('.form-item-metatags-description-value').length > 0) && data.meta_description != null) {
-		            $('.form-item-metatags-description-value > .contentanalysis_section_analysis').remove();
-		            $('.form-item-metatags-description-value').append(data.meta_description['output']);
-		          }
-		          
-		          if(($('.form-item-metatags-keywords-value').length > 0) && data.meta_keywords != null) {
-		            $('.form-item-metatags-keywords-value > .contentanalysis_section_analysis').remove();
-		            $('.form-item-metatags-keywords-value').append(data.meta_keywords['output']);
-		          }
-		        }
-		        for(var i in analyzers_arr) {
-		          var aid = analyzers_arr[i];
-		          h = '<a href="#" class="contentanalysis-refresh-link-' + aid + '" onclick="contentanalysis.contentanalysis_refresh_analysis(\'' + aid + '\'); return false;">';
-		          h += '<img src="' + Drupal.settings.contentanalysis.path_to_module + '/icons/refresh.png" alt="refresh" />';
-		          h += '</a>';
-		          $('.contentanalysis-report-' + aid + ' label').append(h);
-		        } 
-					}      
-		      // call any modules post analysis hooks      
-		      for(var i in analyzers_arr) {
-		        var aid = analyzers_arr[i];        
-		        var module = Drupal.settings.contentanalysis.analyzer_modules[aid].module;     
-		        if (eval('typeof ' + module + '_contentanalysis_analysis_success == "function"')) {
-		          eval(module + '_contentanalysis_analysis_success')(aid, data);
-		        }
-		      } 
-		      if(typeof Drupal.behaviors.collapse == 'function') {
-		    	  Drupal.behaviors.collapse();  
-		      }
-		      $('.ahah-progress-throbber').remove();
-		      $('#contentanalysis-buttons').show();
-		    },
-		    error: function(xhr, status) {
-		      alert(xhr.responseText.toString());
-		      $('.ahah-progress-throbber').remove();
-		      $('#contentanalysis-buttons').show();
-		    }
-		  });
-		  return false;	
-		}
-	});	
+      var tabs = $("#contentanalysis-report-tabs-" + e[3]);
+      var pos = $("#contentanalysis-report-tabs-" + e[3]).position();
+      var offset = $("#contentanalysis-report-tabs-" + e[3]).offset();
+      var height = tabs.height();
+      var top = (pos.top + height) + "px";
+      var left = (pos.left) + "px";
 
-	Drupal.behaviors.contentanalysisui = {
-	  attach: function (context, settings) {
-		$$.init();
-	  }
-	};
-	
-	Sliders = {};
-	
-	Sliders.changeHandle = function(e,ui) {
-	  var id = jQuery(ui.handle).parents('div.slider-widget-container').attr('id');
-	  if (typeof(ui.values) != 'undefined') {
-	    jQuery.each(ui.values, function(i,val) {
-	      jQuery("#"+id+"_value_"+i).val(val);
-	      jQuery("#"+id+"_nr_"+i).text(val);
-	    });
-	  } else {
-	    jQuery("#"+id+"_value_0").val(ui.value);
-	    jQuery("#"+id+"_nr_0").text(ui.value);
-	  }
-	};
+      var sec_id = id.replace('tab', 'results');
+      var result_id = sec_id.replace('-' + e[4], '')
+      $('#' + result_id).css('top', top);
+      $('#' + sec_id).show();
+      $$.contentanalysisPrevReportTab = $$.contentanalysisCurrentReportTab;
+      $$.contentanalysisCurrentReportTab = theTab;
+    },
+
+    // called from inline Analyze content button
+    contentanalysis_inline_analysis:function () {
+      Drupal.settings.contentanalysis.display_dialog = 0;
+      Drupal.settings.contentanalysis.display_inline = 1;
+      $('#contentanalysis-buttons').after('<div class="ahah-progress ahah-progress-throbber"><div class="throbber">&nbsp;</div><div class="message">' + Drupal.t('Analyzing...') + '</div></div>');
+      $$.contentanalysis_analyze();
+    },
+
+    // called from inline Analyze content button
+    contentanalysis_dialog_analysis:function () {
+      Drupal.settings.contentanalysis.display_dialog = 1;
+      Drupal.settings.contentanalysis.display_inline = 0;
+      $$.contentanalysis_analyze();
+    },
+
+    // called from inline Analyze content button
+    contentanalysis_full_analysis:function () {
+      Drupal.settings.contentanalysis.display_dialog = 1;
+      Drupal.settings.contentanalysis.display_inline = 1;
+
+      $$.contentanalysis_analyze();
+    },
+
+    // called from inline Analyze content button
+    contentanalysis_refresh_analysis:function (analyzer) {
+      Drupal.settings.contentanalysis.display_dialog = 0;
+      Drupal.settings.contentanalysis.display_inline = 1;
+      $('.contentanalysis-refresh-link-' + analyzer).replaceWith('<div class="ahah-progress ahah-progress-throbber"><div class="throbber">&nbsp;</div></div>');
+      $$.contentanalysis_analyze(analyzer);
+    },
+
+    contentanalysis_analyze:function (analyzer_override) {
+      // if TinyMCE is used, turn off and on to save body text to textarea
+      var data = {
+        'nid':-1,
+        'node_type':-1,
+        'source':-1,
+        'analyzers':-1,
+        'title':-1,
+        'body':-1,
+        'body_summary':-1,
+        'page_title':-1,
+        'meta_title':-1,
+        'meta_keywords':-1,
+        'meta_description':-1,
+        'path_alias':-1,
+        'path_pathauto':-1,
+        'url':-1,
+        'page':-1,
+        'body_input_filter':-1,
+        'hidden':-1,
+        'code':Drupal.settings.contentanalysis.code,
+        'action':-1
+      };
+      if (analyzer_override) {
+        data.action = 'refresh';
+      }
+      if ($('#contentanalysis-page-analyzer-form').html()) {
+        data.source = 'admin-form';
+        data.body = $('[name=input]').val()
+        data.nid = $('[name=input_nid]').val()
+        data.url = $('[name=input_url]').val()
+        if (data.body == '') {
+          data.body = -1;
+        }
+        if (data.nid == '') {
+          data.nid = -1;
+        }
+        if (data.url == '') {
+          data.url = -1;
+        }
+      }
+      else {
+        if ($('.node-form').html()) {
+          data.source = 'node-edit-form';
+          // Turn off TinyMCE if enabled
+          if (typeof tinyMCE == 'object') {
+            tinyMCE.get('edit-body-und-0-value').hide();
+          }
+          // Turn off CKEditor if any.
+          var ckeditor = false;
+          if ($('#cke_edit-body-und-0-value').html()) {
+            $('#wysiwyg-toggle-edit-body-und-0-value').click();
+            ckeditor = true;
+          }
+
+          data.title = $('#edit-title').val();
+          data.body = $('#edit-body-und-0-value').val();
+          if ($('#edit-body-und-0-summary').val() != null) {
+            data.body_summary = $('#edit-body-und-0-summary').val();
+          }
+          data.nid = Drupal.settings.contentanalysis.nid
+          data.node_type = Drupal.settings.contentanalysis.node_type
+          data.body_input_filter = $("select[name='body[und][0][format]'] option:selected").val();
+
+          if ($('#edit-page-title').val() != null) {
+            data.page_title = $('#edit-page-title').val();
+          }
+          // check if metatag module fields exist
+          if ($('#edit-metatags-title-value').val() != null) {
+            data.meta_title = $('#edit-metatags-title-value').val();
+          }
+          if ($('#edit-metatags-keywords-value').val() != null) {
+            data.meta_keywords = $('#edit-metatags-keywords-value').val();
+          }
+          if ($('#edit-metatags-description-value').val() != null) {
+            data.meta_description = $('#edit-metatags-description-value').val();
+          }
+          if ($('#edit-path-alias').val() != null) {
+            data.url = window.location.host + Drupal.settings.contentanalysis.base_path + $('#edit-path-alias').val();
+            data.path_alias = $('#edit-path-alias').val();
+          }
+          if ($("input[name='path[pathauto]']:checked").val() != null) {
+            data.path_pathauto = 1;
+          }
+          // Turn back on tinyMCE
+          if (typeof tinyMCE == 'object') {
+            tinyMCE.get('edit-body-und-0-value').show();
+          }
+          // Turn back on CKEditor if needed.
+          if (ckeditor) {
+            $('#wysiwyg-toggle-edit-body-und-0-value').click();
+          }
+
+        }
+        else {
+          data.source = 'page-link';
+          data.page = $('html').html()
+          data.url = window.location.href
+        }
+      }
+      if (Drupal.settings.contentanalysis.hidden != null) {
+        data.hidden = Drupal.settings.contentanalysis.hidden;
+      }
+
+      var analyzers_arr = new Array();
+      if (analyzer_override) {
+        data.analyzers = analyzer_override;
+        analyzers_arr[0] = data.analyzers;
+      }
+      else {
+        if ($('#contentanalysis_analyzers_override input').val() != null) {
+          data.analyzers = $('#contentanalysis_analyzers_override input').val();
+          analyzers_arr[0] = data.analyzers;
+        }
+        else {
+          var i = 0;
+          $('#contentanalysis_analyzers .form-checkbox:checked').each(function () {
+            var expr = new RegExp(/\[[^\]]+\]/);
+            analyzers_arr[i] = expr.exec($(this).attr('name'))[0].replace(']', '').replace('[', '');
+            i++;
+          })
+          data.analyzers = analyzers_arr.join(',');
+        }
+      }
+      // call contentanalysis_data for enabed analyzers
+      for (var i in analyzers_arr) {
+        var aid = analyzers_arr[i];
+        var module = Drupal.settings.contentanalysis.analyzer_modules[aid].module;
+        if (eval('typeof ' + module + '_contentanalysis_data == "function"')) {
+          d = eval(module + '_contentanalysis_data')(aid, data);
+          for (var k in d) {
+            eval('data.ao_' + aid + '_' + k + ' = "' + d[k] + '";');
+          }
+        }
+      }
+      $('#contentanalysis-buttons').hide();
+      $.ajax({
+        type:'POST',
+        url:Drupal.settings.contentanalysis.analyze_callback,
+        data:data,
+        dataType:'json',
+        success:function (data, textStatus) {
+          analyzers_arr = data.inputs['analyzers'].split(",");
+          if (Drupal.settings.contentanalysis.display_dialog == 1) {
+            $('#analysis-modal').append(data.main['output']);
+            $('#analysis-modal .progress').remove();
+            $$.contentanalysis_contentanalysisui()
+          }
+          // display inline if enabled
+          if (Drupal.settings.contentanalysis.display_inline == 1) {
+            if (data.inputs['action'] == 'refresh') {
+              for (i in analyzers_arr) {
+                aid = analyzers_arr[i];
+                $('.contentanalysis-report-' + aid + '-page_title').replaceWith(data.page_title['output']);
+                $('.contentanalysis-report-' + aid + '-body').replaceWith(data.body['output']);
+                $('.contentanalysis-report-' + aid + '-meta_description').replaceWith(data.meta_description['output']);
+                $('.contentanalysis-report-' + aid + '-meta_keywords').replaceWith(data.meta_keywords['output']);
+              }
+            }
+            else {
+              var show_title = true;
+              if ($('.form-item-metatags-title-value').length > 0) {
+                $('.form-item-metatags-title-value > .contentanalysis_section_analysis').remove();
+                $('.form-item-metatags-title-value').append(data.page_title['output']);
+                // check if metatag-title contains [node:title] token
+                if ($('#edit-metatags-title-value').val() != null) {
+                  var meta_title = $('#edit-metatags-title-value').val();
+                  if (meta_title.indexOf("[node:title]") == -1) {
+                  }
+                }
+              }
+              if (show_title) {
+                $('.form-item-title > .contentanalysis_section_analysis').remove();
+                $('.form-item-title').append(data.page_title['output']);
+              }
+
+              $('#edit-body > .contentanalysis_section_analysis').remove();
+              $('#edit-body').append(data.body['output']);
+              // check newer nodewords format
+              if (($('.form-item-metatags-description-value').length > 0) && data.meta_description != null) {
+                $('.form-item-metatags-description-value > .contentanalysis_section_analysis').remove();
+                $('.form-item-metatags-description-value').append(data.meta_description['output']);
+              }
+
+              if (($('.form-item-metatags-keywords-value').length > 0) && data.meta_keywords != null) {
+                $('.form-item-metatags-keywords-value > .contentanalysis_section_analysis').remove();
+                $('.form-item-metatags-keywords-value').append(data.meta_keywords['output']);
+              }
+            }
+            for (var i in analyzers_arr) {
+              var aid = analyzers_arr[i];
+              h = '<a href="#" class="contentanalysis-refresh-link-' + aid + '" onclick="contentanalysis.contentanalysis_refresh_analysis(\'' + aid + '\'); return false;">';
+              h += '<img src="' + Drupal.settings.contentanalysis.path_to_module + '/icons/refresh.png" alt="refresh" />';
+              h += '</a>';
+              $('.contentanalysis-report-' + aid + ' label').append(h);
+            }
+          }
+          // call any modules post analysis hookscontentanalysis_show_report_tab(contentanalysisPrevReportTab);
+          for (var i in analyzers_arr) {
+            var aid = analyzers_arr[i];
+            var module = Drupal.settings.contentanalysis.analyzer_modules[aid].module;
+            if (eval('typeof ' + module + '_contentanalysis_analysis_success == "function"')) {
+              eval(module + '_contentanalysis_analysis_success')(aid, data);
+            }
+          }
+          if (typeof Drupal.behaviors.collapse == 'function') {
+            Drupal.behaviors.collapse();
+          }
+          $('.ahah-progress-throbber').remove();
+          $('#contentanalysis-buttons').show();
+        },
+        error:function (xhr, status) {
+          alert(xhr.responseText.toString());
+          $('.ahah-progress-throbber').remove();
+          $('#contentanalysis-buttons').show();
+        }
+      });
+      return false;
+    }
+  });
+
+  Drupal.behaviors.contentanalysisui = {
+    attach:function (context, settings) {
+      $$.init();
+    }
+  };
+
+  Sliders = {};
+
+  Sliders.changeHandle = function (e, ui) {
+    var id = jQuery(ui.handle).parents('div.slider-widget-container').attr('id');
+    if (typeof(ui.values) != 'undefined') {
+      jQuery.each(ui.values, function (i, val) {
+        jQuery("#" + id + "_value_" + i).val(val);
+        jQuery("#" + id + "_nr_" + i).text(val);
+      });
+    }
+    else {
+      jQuery("#" + id + "_value_0").val(ui.value);
+      jQuery("#" + id + "_nr_0").text(ui.value);
+    }
+  };
 
 })(jQuery, contentanalysis);
diff --git a/contentanalysis.module b/contentanalysis.module
index bdb8a8d..d1a1e11 100644
--- a/contentanalysis.module
+++ b/contentanalysis.module
@@ -1,19 +1,16 @@
 <?php
-// $Id: contentanalysis.module,v 1.1.2.14 2010/09/26 15:27:18 tomdude48 Exp $
-
 /**
  * @file
- * Provides API to enable analyzer modules to interface with web content and display an analysis 
+ * Provides API to enable analyzer modules to interface with web content and display an analysis
  */
 
-//require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'contentanalysis') . "/includes/seo_friend.inc";
 require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'contentanalysis') . "/includes/theme.inc";
 
 DEFINE('CONTENTANALYSIS_NODE_PARSE_NODETITLE_TAGS_DEFAULT', '<h1 class="title" id="page-title">[node:title]</h1>');
 DEFINE('CONTENTANALYSIS_NODE_PARSE_NODETITLE_PREPEND_DEFAULT', 1);
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function contentanalysis_menu() {
   $items = array();
@@ -49,11 +46,12 @@ function contentanalysis_menu() {
   $items['admin/reports/contentanalysis'] = array(
     'title' => 'Content analysis',
     'description' => 'Analyze nodes, web pages and free form content.',
-    'page callback' => 'contentanalysis_page_analyzer',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('contentanalysis_page_analyzer'),
     'access callback' => 'user_access',
     'access arguments' => array('perform content analysis'),
     'type' => MENU_NORMAL_ITEM,
-  );  
+  );
   $items['contentanalysis/analyze_js'] = array(
     'title' => '',
     'page callback' => 'contentanalysis_analyze_js',
@@ -75,49 +73,9 @@ function contentanalysis_menu() {
     'access arguments' => array('perform content analysis'),
     'type' => MENU_CALLBACK,
   );
-  $items['contentanalysis/util'] = array(
-    'title' => 'Contentanalysis util',
-    'page callback' => 'contentanalysis_util',
-    'access callback' => 'user_access',
-    'access arguments' => array('admin'),
-    'type' => MENU_CALLBACK,
-  );
   return $items;
 }
 
-function contentanalysis_util() {
-
-return 'ok'; 
-	$node = node_load(2);
- $options = array(
-    'entity_type' => 'node',
-    'entity' => $node,
-    'view_mode' => 'full',
-    'display_mode' => 'full',
-    'token data' => array(
-     'node' => $node,
-    )
- );
- $metatags = array(
-    'title' => array(
-     'value' => '[node:title] YES [site:name]',
-    ),
-    'keywords' => array(
-     'value' => 'echo, foxtrot',
-    ),
-    'description' => array(
-     'value' => 'YES [node:summary]',
-    ),
- );
-
- $ret = metatag_metatags_view('global', array());
-//dsm($ret);
- $ret = metatag_metatags_view('node:article', $metatags, $options);
-//dsm($ret);
-
-  return 'ok';
-}
-
 /**
  * Implementation of hook_perm()
  */
@@ -137,15 +95,16 @@ function contentanalysis_modal_popup() {
   ctools_include('ajax');
   ctools_include('modal');
   $title = t('Content Analysis Results');
-  //$html = contentanalysis_analyze();
-  $html = '<div id="analysis-modal">' . theme_progress_bar(array( 'percent' => 0, 'message' => t('Analyzing Content'))) . '</div><script type="text/javascript">contentanalysis.contentanalysis_full_analysis();</script>';
+  $html = '<div id="analysis-modal">' . theme('progress_bar', array(
+    'percent' => 0,
+    'message' => t('Analyzing Content')
+  )) . '</div><script type="text/javascript">contentanalysis.contentanalysis_full_analysis();</script>';
   $output[] = ctools_modal_command_display($title, $html);
   if (!$output) {
     $output = array();
     $output[] = ctools_ajax_command_append('#modal-message', '<div id="message">test text</div>');
     $output[] = ctools_modal_command_dismiss();
   }
-  //ctools_ajax_render($output);
   print ajax_render($output);
   exit;
 }
@@ -157,39 +116,29 @@ function contentanalysis_modal_popup_only() {
   ctools_include('ajax');
   ctools_include('modal');
   $title = t('Content Analysis Results');
-  //$html = contentanalysis_analyze_popup_only();
-  $html = '<div id="analysis-modal">' . theme_progress_bar(array( 'percent' => 0, 'message' => t('Analyzing Content'))) . '</div>' . $output . '<script type="text/javascript">contentanalysis.contentanalysis_dialog_analysis();</script>';
+  $html = '<div id="analysis-modal">' . theme('progress_bar', array(
+    'percent' => 0,
+    'message' => t('Analyzing Content')
+  )) . '</div>' .
+    '<script type="text/javascript">contentanalysis.contentanalysis_dialog_analysis();</script>';
   $output[] = ctools_modal_command_display($title, $html);
   if (!$output) {
     $output = array();
     $output[] = ctools_ajax_command_append('#modal-message', '<div id="message">test text</div>');
     $output[] = ctools_modal_command_dismiss();
   }
-  //ctools_ajax_render($output);
   print ajax_render($output);
   exit;
 }
 
 /**
- * Presents analyzer admin form
- * @see contentanalysis_page_analyzer_form()
- */
-function contentanalysis_page_analyzer() {
-  drupal_add_css(drupal_get_path('module', 'contentanalysis') . '/contentanalysis.admin.css');
-  
-  $output = render(drupal_get_form('contentanalysis_page_analyzer_form', array()));  
-  
-  return $output;
-}
-
-/**
  * Provides content analysis admin form
- * 
+ *
  * - prepends three admin form input fields
  * - merges form from contentanalysis_analysis_form()
- * 
+ *
  * @see contentanalysis_analysis_form()
- * 
+ *
  * @param $form_state
  *   standard form_api form_state array
  * @param $analysis
@@ -197,13 +146,13 @@ function contentanalysis_page_analyzer() {
  * @return
  *   form_api formated array
  */
-function contentanalysis_page_analyzer_form($form_state, $analysis) {
+function contentanalysis_page_analyzer_form($form_state, $analysis = array()) {
   $form['instructions'] = array(
     '#markup' => t('You can specify content to be analyzed using one of the three below methods. Use only one method. Either enter text content, use a numeric node id, or provide a URL to an existing webpage.'),
   );
   $form['input'] = array(
     '#type' => 'textarea',
-    '#title' => t('Content'),    
+    '#title' => t('Content'),
     '#default_value' => isset($analysis['#context']['inputs']['text']) ? $analysis['#context']['inputs']['text'] : '',
   );
   $form['input_nid'] = array(
@@ -217,21 +166,21 @@ function contentanalysis_page_analyzer_form($form_state, $analysis) {
     '#title' => t('URL'),
     '#default_value' => isset($analysis['#context']['inputs']['url']) ? $analysis['#context']['inputs']['url'] : '',
   );
-  
+
   $form = array_merge($form, contentanalysis_analysis_form($form_state, $analysis, array(), 'admin'));
- 
+
   return $form;
 }
 
 /**
  * Provides common Content Analysis form fields
- * 
+ *
  * - creates checkboxes of installed analyzers
- * - requests additional fields from analyzer modules for analyzer 
+ * - requests additional fields from analyzer modules for analyzer
  *   definitions declaring "form elements callback"
  * - initializes Drupal.settings for AJAX calls
  * - formats fields according to the requested interface
- * 
+ *
  * @param $form_state
  *   standard form_state generated by form_api
  * @param $analysis
@@ -242,24 +191,24 @@ function contentanalysis_page_analyzer_form($form_state, $analysis) {
  *   The style of form to return, options are [admin|node-edit|block]
  * @return
  *   form_api formated array
- *   
+ *
  */
 function contentanalysis_analysis_form($form_state, $analysis = array(), $node = array(), $mode = 'admin') {
   // check the number of calls
-  
+
   drupal_add_js(drupal_get_path('module', 'contentanalysis') . '/contentanalysis.js');
   ctools_include('ajax'); // Module  include the dependence it needs for ajax.
   ctools_include('modal');
   ctools_modal_add_js();
   ctools_add_js('ajax-responder');
-  
+
   $fields = array();
-  
-  drupal_add_css(drupal_get_path('module', 'contentanalysis') . '/contentanalysis.css');  
+
+  drupal_add_css(drupal_get_path('module', 'contentanalysis') . '/contentanalysis.css');
   $display = variable_get('contentanalysis_display', array('sections', 'main'));
   $analyzers = contentanalysis_analyzer_info();
   $analyzer_modules = array();
-  
+
   foreach ($analyzers AS $aid => $analyzer) {
     if ($analyzer['module']) {
       $analyzer_modules[$aid] = array(
@@ -283,40 +232,42 @@ function contentanalysis_analysis_form($form_state, $analysis = array(), $node =
     $display_dialog = 0;
   }
 
-  // hack protecting settings on mutiple calls
+  // hack protecting settings on multiple calls
   static $js_added;
   if (!$js_added) {
     drupal_add_js(
-      array('contentanalysis' => array(
-        'analyze_callback' => variable_get('contentanalysis_host', '') . base_path() . 'contentanalysis/analyze_js',
-        'base_path' => base_path(),
-        'path_to_module' => base_path() . drupal_get_path('module', 'contentanalysis'),
-        'nid' => isset($node->nid) ? $node->nid : -1,
-        'node_type' => isset($node->type) ? $node->type : -1,
-        'display_sections' => ((isset($display['sections']) && $display['sections'] )?1:0),
-        'display_main' => ((isset($display['main']) && $display['main'])?1:0),
-        'analyze_on_start' => variable_get('contentanalysis_analyze_on_start', '0'),    
-        'analyzer_modules' => $analyzer_modules,
-        'code' => $code,
-        'display_dialog' => $display_dialog,
-        'display_inline' => $display_inline,
-      )), 
-    'setting');
+      array(
+        'contentanalysis' => array(
+          'analyze_callback' => variable_get('contentanalysis_host', '') . base_path() . 'contentanalysis/analyze_js',
+          'base_path' => base_path(),
+          'path_to_module' => base_path() . drupal_get_path('module', 'contentanalysis'),
+          'nid' => isset($node->nid) ? $node->nid : -1,
+          'node_type' => isset($node->type) ? $node->type : -1,
+          'display_sections' => (isset($display['sections']) && $display['sections']) ? 1 : 0,
+          'display_main' => (isset($display['main']) && $display['main']) ? 1 : 0,
+          'analyze_on_start' => variable_get('contentanalysis_analyze_on_start', '0'),
+          'analyzer_modules' => $analyzer_modules,
+          'code' => $code,
+          'display_dialog' => $display_dialog,
+          'display_inline' => $display_inline,
+        )
+      ),
+      'setting');
     $js_added = TRUE;
   }
-  
+
   $fields['analyzers'] = contentanalysis_get_analyzer_form_element($analysis, $analyzers);
 
   foreach ($analyzers AS $aid => $analyzer) {
     if (isset($analyzer['form elements callback']) && $analyzer['form elements callback']) {
-      $e = call_user_func($analyzer['form elements callback'], $form_state, $analysis, $node); 
-      if (is_array($e)) {        
+      $e = call_user_func($analyzer['form elements callback'], $form_state, $analysis, $node);
+      if (is_array($e)) {
         $fs = array(
           '#type' => 'fieldset',
           '#title' => $analyzer['title'] . ' ' . t('analyzer options'),
           '#tree' => TRUE,
         );
-        $fields[$aid] = array_merge($fs, $e);        
+        $fields[$aid] = array_merge($fs, $e);
       }
     }
   }
@@ -327,20 +278,26 @@ function contentanalysis_analysis_form($form_state, $analysis = array(), $node =
     if ($report_style == 'both') {
       $form['clickme'] = array(
         '#type' => 'markup',
-        '#markup' => '<div id="contentanalysis-buttons">' .   $output = ctools_ajax_text_button(t('Analyze content'), 'contentanalysis/ajax/analysis', t('Content Analysis'), 'contentanalysis-button', 'ctools-use-modal') . '</div>'
+        '#markup' => '<div id="contentanalysis-buttons">' . ctools_ajax_text_button(t('Analyze content'), 'contentanalysis/ajax/analysis', t('Content Analysis'), 'contentanalysis-button', 'ctools-use-modal') . '</div>'
       );
     }
     elseif ($report_style == 'dialog') {
       $form['clickme'] = array(
         '#type' => 'markup',
-        '#markup' => '<div id="contentanalysis-buttons">' .   $output = ctools_ajax_text_button(t('Analyze content'), 'contentanalysis/ajax/analysis_only', t('Content Analysis'), 'contentanalysis-button', 'ctools-use-modal') . '</div>'
-      ); 
-    } 
+        '#markup' => '<div id="contentanalysis-buttons">' . ctools_ajax_text_button(t('Analyze content'), 'contentanalysis/ajax/analysis_only', t('Content Analysis'), 'contentanalysis-button', 'ctools-use-modal') . '</div>'
+      );
+    }
     elseif ($report_style == 'inline') {
       $form['clickme'] = array(
         '#type' => 'markup',
-        '#markup' => '<div id="contentanalysis-buttons">' . l(t('Analyze content'), base_path() . 'contentanalysis/analyze_js', array('attributes' => array('id' => 'contentanalysis-ininline-analysis-button', 'class' => "contentanalysis-analyze-content contentanalysis-button", "onclick" => "contentanalysis_inline_analysis(); return (false);"))) . '</div>'
-      );    
+        '#markup' => '<div id="contentanalysis-buttons">' . l(t('Analyze content'), base_path() . 'contentanalysis/analyze_js', array(
+          'attributes' => array(
+            'id' => 'contentanalysis-ininline-analysis-button',
+            'class' => 'contentanalysis-analyze-content contentanalysis-button',
+            'onclick' => 'contentanalysis_inline_analysis(); return (false);'
+          )
+        )) . '</div>'
+      );
     }
     else {
       $v = '<div id="contentanalysis-buttons">';
@@ -350,43 +307,42 @@ function contentanalysis_analysis_form($form_state, $analysis = array(), $node =
       $v .= ctools_ajax_text_button(t('Main report'), 'contentanalysis/ajax/analysis_only', t('Content Analysis'), 'contentanalysis-button', 'ctools-use-modal');
       $v .= ' ';
       $v .= '<a href="#" id="contentanalysis-ininline-analysis-button" class="contentanalysis-analyze-content contentanalysis-button" onclick="contentanalysis_inline_analysis(); return (false);">' . t('Inline reports') . '</a>';
-      //$v .= l(t('Inline recommendations'), '#', array('attributes' => array('class' => "contentanalysis-analyze-content", "onclick" => "contentanalysis_inline_analysis(); return (false);")));
       $v .= '</div>';
       $form['clickme'] = array(
         '#type' => 'markup',
         '#markup' => $v,
-      ); 
+      );
     }
-  } 
+  }
   elseif ($mode == 'admin') {
     $form = $fields;
     $form['clickme'] = array(
       '#type' => 'markup',
       '#markup' => '<div>' . $output = ctools_ajax_text_button(t('Analyze content'), 'contentanalysis/ajax/analysis', t('Content Analysis'), 'contentanalysis-button', 'ctools-use-modal') . '</div>'
-    );  
-  } 
+    );
+  }
   else {
     $form['clickme'] = array(
       '#type' => 'markup',
       '#markup' => '<div>' . $output = ctools_ajax_text_button(t('Analyze content'), 'contentanalysis/ajax/analysis', t('Content Analysis'), 'contentanalysis-button', 'ctools-use-modal') . '</div>'
     );
-    
+
     $form['contentanalysis_options'] = array(
       '#title' => t('options'),
       '#type' => 'fieldset',
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
-      
-    ); 
+
+    );
     $form['contentanalysis_options'] = array_merge($form['contentanalysis_options'], $fields);
   }
-  
+
   return $form;
 }
 
 /**
  * Generates analyzer enable/disable checkboxes field
- * 
+ *
  * @param $params
  *   Associative array of overrides for settings. Overrides include: [title|description|nid]
  * @param $analyzers
@@ -409,7 +365,7 @@ function contentanalysis_get_analyzer_form_element($params = array(), $analyzers
       foreach ($analysis['#context']['inputs']['analyzers'] AS $aid => $item) {
         $default_value[] = $aid;
       }
-    } 
+    }
     else {
       $default_value = variable_get('contentanalysis_default_analyzers', $defaults);
     }
@@ -418,24 +374,24 @@ function contentanalysis_get_analyzer_form_element($params = array(), $analyzers
       $k = array_keys($options);
       $element = array(
         '#type' => 'hidden',
-        '#value' => $k[0], 
+        '#value' => $k[0],
         '#prefix' => '<div id="contentanalysis_analyzers_override">',
         '#suffix' => '</div>',
       );
-    } 
+    }
     else {
       $element = array(
         '#type' => 'checkboxes',
-        '#title' => (isset($params['title']) && $params['title'])?$params['title']:t('Analyzers'), 
-        '#description' => (isset($params['description']) && $params['description'])?$params['description']:t('Select analyzers for content.'),
+        '#title' => (isset($params['title']) && $params['title']) ? $params['title'] : t('Analyzers'),
+        '#description' => (isset($params['description']) && $params['description']) ? $params['description'] : t('Select analyzers for content.'),
         '#options' => $options,
-        '#default_value' => $default_value, 
+        '#default_value' => $default_value,
         '#prefix' => '<div id="contentanalysis_analyzers">',
         '#suffix' => '</div>',
       );
     }
 
-  } 
+  }
   else {
     drupal_set_message(t('No content analyzers are enabled.'), 'error');
     return FALSE;
@@ -445,13 +401,13 @@ function contentanalysis_get_analyzer_form_element($params = array(), $analyzers
 
 /**
  * Returns content analysis for AJAX calls
- * 
+ *
  * - initializes context from AJAX _POST data
  * - submits context to contentanalysis_do_analysis for analysis
  * - formats returned analysis
- * 
+ *
  * @see contentanalysis_do_analysis()
- * 
+ *
  * @return
  *   JSON formated analysis
  */
@@ -464,29 +420,29 @@ function contentanalysis_analyze_js() {
 
   $context = contentanalysis_get_default_context();
   $context['form_id'] = 'contentanalysis_analyze_js';
-  
-  $context['inputs']['nid'] = ($_POST['nid']=='-1')?NULL:$_POST['nid'];
-  $context['inputs']['url'] = ($_POST['url']=='-1')?NULL:$_POST['url'];
-  $context['inputs']['title'] = ($_POST['title']=='-1')?NULL:$_POST['title'];
-  $context['inputs']['page_title'] = ($_POST['page_title']=='-1')?NULL:$_POST['page_title'];
-  $context['inputs']['meta_title'] = ($_POST['meta_title']=='-1')?NULL:$_POST['meta_title'];
-  $context['inputs']['body'] = ($_POST['body']=='-1')?NULL:$_POST['body'];
-  $context['inputs']['body_summary'] = ($_POST['body_summary']=='-1')?NULL:$_POST['body_summary'];
-  $context['inputs']['meta_keywords'] = ($_POST['meta_keywords']=='-1')?NULL:$_POST['meta_keywords'];
-  $context['inputs']['meta_description'] = ($_POST['meta_description']=='-1')?NULL:$_POST['meta_description']; 
-  $context['inputs']['page'] = ($_POST['page']=='-1')?NULL:$_POST['page'];
-  $context['inputs']['node_type'] = ($_POST['node_type']=='-1')?NULL:$_POST['node_type'];
+
+  $context['inputs']['nid'] = ($_POST['nid'] == '-1') ? NULL : $_POST['nid'];
+  $context['inputs']['url'] = ($_POST['url'] == '-1') ? NULL : $_POST['url'];
+  $context['inputs']['title'] = ($_POST['title'] == '-1') ? NULL : $_POST['title'];
+  $context['inputs']['page_title'] = ($_POST['page_title'] == '-1') ? NULL : $_POST['page_title'];
+  $context['inputs']['meta_title'] = ($_POST['meta_title'] == '-1') ? NULL : $_POST['meta_title'];
+  $context['inputs']['body'] = ($_POST['body'] == '-1') ? NULL : $_POST['body'];
+  $context['inputs']['body_summary'] = ($_POST['body_summary'] == '-1') ? NULL : $_POST['body_summary'];
+  $context['inputs']['meta_keywords'] = ($_POST['meta_keywords'] == '-1') ? NULL : $_POST['meta_keywords'];
+  $context['inputs']['meta_description'] = ($_POST['meta_description'] == '-1') ? NULL : $_POST['meta_description'];
+  $context['inputs']['page'] = ($_POST['page'] == '-1') ? NULL : $_POST['page'];
+  $context['inputs']['node_type'] = ($_POST['node_type'] == '-1') ? NULL : $_POST['node_type'];
   $context['inputs']['body_input_filter'] = (!isset($_POST['body_input_filter']) || $_POST['body_input_filter'] == '-1') ? NULL : $_POST['body_input_filter'];
-  $context['inputs']['hidden'] = ($_POST['hidden']=='-1')?NULL:$_POST['hidden'];  
-  $context['inputs']['action'] = ($_POST['action']=='-1')?NULL:$_POST['action']; 
-  
-  $context['source'] = $_POST['source'];  
+  $context['inputs']['hidden'] = ($_POST['hidden'] == '-1') ? NULL : $_POST['hidden'];
+  $context['inputs']['action'] = ($_POST['action'] == '-1') ? NULL : $_POST['action'];
+
+  $context['source'] = $_POST['source'];
   $context['nid'] = $context['inputs']['nid'];
-  $context['url'] = $context['inputs']['url'];    
-  
+  $context['url'] = $context['inputs']['url'];
+
   // load analyzers using hook_contentanalysis_analyzers
   $analyzer_defs = contentanalysis_analyzer_info();
-  
+
   $analyzers = array();
   $a = explode(',', $_POST['analyzers']);
   $context['inputs']['analyzers'] = array();
@@ -496,115 +452,137 @@ function contentanalysis_analyze_js() {
       $analyzers[$aid] = $analyzer_defs[$aid];
     }
   }
-  
+
   foreach ($_POST AS $k => $v) {
     if (substr($k, 0, 3) == 'ao_') {
       list($t, $aid, $vk) = explode('_', $k);
       $context['inputs']['analyzer_options'][$aid][$vk] = $v;
-    } 
+    }
   }
-  
+
   $context['title'] = $context['inputs']['title'];
   $context['page_title'] = $context['inputs']['page_title'];
   $context['body'] = $context['inputs']['body'];
   $context['meta_title'] = $context['inputs']['meta_title'];
   $context['meta_keywords'] = $context['inputs']['meta_keywords'];
   $context['meta_description'] = $context['inputs']['meta_description'];
-  $context['page'] = $context['inputs']['page'];  
-  
+  $context['page'] = $context['inputs']['page'];
+
   if (isset($context['options']) && isset($context['options']['exit'])) {
     $analysis['#context'] = $context;
-  } 
+  }
   else {
     // if url is input from admin form, go fetch the page contents
     if (($context['source'] == 'admin-form') && ($context['url']) && !$context['nid'] && !$context['body']) {
-     $context['page'] =  file_get_contents($context['url']);     
+      $context['page'] = file_get_contents($context['url']);
     }
-    
+
     $analysis = contentanalysis_do_analysis($context, $analyzers);
-    
+
     foreach ($analyzers AS $aid => $analyzer) {
       if ($analyzer['admin form submit callback']) {
-        call_user_func($analyzer['admin form submit callback'], $form, $form_state);   
+        call_user_func($analyzer['admin form submit callback'], $form, $form_state);
       }
-    } 
-    
+    }
+
     $analysis = contentanalysis_build_analysis_content($analysis);
     contentanalysis_save_status($analysis);
   }
-  
+
   $output = array();
+  // TODO: convert to drupal theme functions defined by hook_theme().
   $output['main']['output'] = theme_contentanalysis_analysis($analysis);
   $output['page_title']['output'] = theme_contentanalysis_section_analysis($analysis, 'page_title');
   $output['body']['output'] = theme_contentanalysis_section_analysis($analysis, 'body');
   $output['meta_keywords']['output'] = theme_contentanalysis_section_analysis($analysis, 'meta_keywords');
   $output['meta_description']['output'] = theme_contentanalysis_section_analysis($analysis, 'meta_description');
-  $output['inputs']['analyzers'] = implode(",", $analysis['#context']['inputs']['analyzers']);
-  
+  $output['inputs']['analyzers'] = implode(',', $analysis['#context']['inputs']['analyzers']);
+
   $output['inputs']['action'] = $analysis['#context']['inputs']['action'];
 
-//dsm($output);
   drupal_json_output($output);
 }
 
 function contentanalysis_save_status($analysis) {
   $aid = isset($analysis['#context']['aid']) ? $analysis['#context']['aid'] : NULL;
   if (!$aid) {
-  	return;
+    return;
   }
-  foreach ($analysis AS $anid => $analysisi) {
-    if (substr($anid, 0, 1)=='#' || !is_array($analysisi)) { 
-      continue; 
+  foreach ($analysis AS $anid => $analysis_item) {
+    if (substr($anid, 0, 1) == '#' || !is_array($analysis_item)) {
+      continue;
     }
-    if((isset($analysisi['#status']) && ($analysisi['#status'] != 'status')) || ($analysisi['#score'])) {
-		  $statusi = array(
-	      'error' => 0,
-			  'warning' => 1,
-			  'complete' => 2,
-		  );
-		  $fields = array(
-		    'status' => $analysisi['#status'],
-		    'statusi' => $statusi[$analysisi['#status']],
-		  );
-		  if($analysisi['#score']) {
-		    $fields['score'] = $analysisi['#score'];
-		  }
-		  $keys = array(
+    if ((isset($analysis_item['#status']) && ($analysis_item['#status'] != 'status')) || ($analysis_item['#score'])) {
+      $status = array(
+        'error' => 0,
+        'warning' => 1,
+        'complete' => 2,
+      );
+      $fields = array(
+        'status' => $analysis_item['#status'],
+        'statusi' => $status[$analysis_item['#status']],
+      );
+      if ($analysis_item['#score']) {
+        $fields['score'] = $analysis_item['#score'];
+      }
+      $keys = array(
         'aid' => $aid,
-        'analyzer' => $anid,		  
-		  );
-		  $query = db_merge('contentanalysis_status')
-		    ->key($keys)
-		    ->fields($fields);
-		    
-		  $updated = $query->execute();
+        'analyzer' => $anid,
+      );
+      $query = db_merge('contentanalysis_status')
+        ->key($keys)
+        ->fields($fields);
+
+      $updated = $query->execute();
     }
   }
 }
 
 /**
  * Provides initial format for context associative array
- * 
+ *
  * @return
- *   Initialized context associative array
+ *  Returns an associative array of initialized context, with the following
+ *  key-value pairs:
+ *  - aid: analysis id
+ *  - form_id: id of form that submitted the content
+ *  - source: source of request
+ *  - nid: the Drupal node id
+ *  - path: the Drupal path, after base_path, for a Drupal page
+ *  - url: full url including http://
+ *  - page: the contents of a page if a full page is to be analyzed, e.g. by
+ *    using a URL to fetch a page
+ *  - title: a drupal page title, e.g. a node title or header for other
+ *    types of Drupal pages
+ *  - node_body: content of the node body field
+ *  - body: the main body of text to be analyzed. for a node it is the node
+ *    body, plus title or any cck fields. For a page it is all content between
+ *    the body tags
+ *  - body_notags: the body field with all stripped of all HTML tags
+ *  - page_title: the title found between the title tags in the header section
+ *    of a HTMLdoc.
+ *  - meta_title: the meta title found in the ehader section of a HTML doc
+ *  - meta_keywords: the meta keywords found in the header section of a HTML doc.
+ *  - meta_description: the meta keywords found in the header section of a HTML doc.
+ *  - analyzers: array of analysers
  */
 function contentanalysis_get_default_context() {
   $context = array(
-    'aid' => NULL,              // analysis id
-    'form_id' => NULL,          // id of form that submitted the content
-    'source' => NULL,           // source of request
-    'nid' => NULL,              // the Drupal node id
-    'path' => NULL,             // the Drupal path, after base_path, for a Drupal page
-    'url' => NULL,              // full url including http://
-    'page' => NULL,             // the contents of a page if a full page is to be analyzed, e.g. by using a URL to fetch a page
-    'title' => NULL,            // a drupal page title, e.g. a node title or header for other types of Drupal pages
-    'node_body' => NULL,        // content of the node body field
-    'body' => NULL,             // the main body of text to be analyzed. for a node it is the node body, plus title or any cck fields. For a page it is all content between the body tags
-    'body_notags' => NULL,      // the body field with all stripped of all HTML tags
-    'page_title' => NULL,       // the title found between the title tags in the header section of a HTMLdoc.
-    'meta_title' => NULL,       // the meta title found in the ehader section of a HTML doc
-    'meta_keywords' => NULL,    // the meta keywords found in the header section of a HTML doc.
-    'meta_description' => NULL, // the meta keywords found in the header section of a HTML doc.
+    'aid' => NULL,
+    'form_id' => NULL,
+    'source' => NULL,
+    'nid' => NULL,
+    'path' => NULL,
+    'url' => NULL,
+    'page' => NULL,
+    'title' => NULL,
+    'node_body' => NULL,
+    'body' => NULL,
+    'body_notags' => NULL,
+    'page_title' => NULL,
+    'meta_title' => NULL,
+    'meta_keywords' => NULL,
+    'meta_description' => NULL,
     'analyzers' => array(),
   );
   return $context;
@@ -612,47 +590,50 @@ function contentanalysis_get_default_context() {
 
 /**
  * Inspects context to select a normalizing context parser
- * 
+ *
  * @param $the_context
  *   Initialized contentalaysis context formated array
- *   
- * 
+ *
+ *
  * @return
  *   A normalized context array
  */
 function contentanalysis_parse_context($the_context, $analysis) {
-  
+
   $context = contentanalysis_get_default_context();
-  
-  if (is_array($the_context)) {   
+
+  if (is_array($the_context)) {
     $context = array_merge($context, $the_context);
   }
 
   // select which parser to use
   if ($context['source'] == 'node-edit-form') {
     return contentanalysis_parse_context_node_edit($context, $analysis);
-  } 
-  elseif ($context['nid'] > 0) { // analysis by nid
+  }
+  elseif ($context['nid'] > 0) {
+    // analysis by nid
     return contentanalysis_parse_context_node_load($context, $analysis);
-  } 
-  elseif ($context['body']) { // analysis by direct text input
+  }
+  elseif ($context['body']) {
+    // analysis by direct text input
     $context['body_notags'] = strip_tags($context['body']);
-  } 
-  elseif ($context['page']) { // analysis by url
+  }
+  elseif ($context['page']) {
+    // analysis by url
     return contentanalysis_parse_context_page($context, $analysis);
   }
-  
-  return $context; 
- 
+
+  return $context;
+
 }
 
 
 /**
  * Normalizes context data inputed by node edit form
- * 
+ *
  * @param $the_context
  *   Initialized context formated array
- * 
+ *
  * @return
  *   A normalized context array
  */
@@ -660,7 +641,7 @@ function contentanalysis_parse_context_node_edit($context, &$analysis) {
   // create dumby node from inputs
   if ($context['nid'] && is_numeric($context['nid'])) {
     $context['node'] = node_load($context['nid']);
-  } 
+  }
   if (!isset($context['node']) && !$context['node']) {
     $context['node'] = new stdClass();
     $context['node']->type = 'article';
@@ -668,24 +649,25 @@ function contentanalysis_parse_context_node_edit($context, &$analysis) {
     $context['node']->language = LANGUAGE_NONE;
   }
 
-  
+
   $context['node']->title = $context['title'];
-  $context['node']->body[$context['node']->language][0]['value']   = $context['body'];
+  $body_field = &$context['node']->body[$context['node']->language][0];
+  $body_field['value'] = $context['body'];
   // get teaser trim length if available from field
   if ($context['inputs']['body_summary']) {
-  	$context['node']->body[$context['node']->language][0]['summary'] = $context['inputs']['body_summary'];
+    $body_field['summary'] = $context['inputs']['body_summary'];
   }
-  else if ($items = field_get_items('node', $context['node'], 'body')) {
+  elseif ($items = field_get_items('node', $context['node'], 'body')) {
     $instance = field_info_instance('node', 'body', $context['node']->type);
-    $context['node']->body[$context['node']->language][0]['summary'] = text_summary($context['body'], $context['inputs']['body_input_filter'], $instance['display']['teaser']['settings']['trim_length']);
+    $body_field['summary'] = text_summary($context['body'], $context['inputs']['body_input_filter'], $instance['display']['teaser']['settings']['trim_length']);
   }
   else {
-    $context['node']->body[$context['node']->language][0]['summary'] = text_summary($context['body'], $context['inputs']['body_input_filter']);
+    $body_field['summary'] = text_summary($context['body'], $context['inputs']['body_input_filter']);
   }
-  $context['node']->body[$context['node']->language][0]['format']  = $context['inputs']['body_input_filter'];
+  $body_field['format'] = $context['inputs']['body_input_filter'];
   // force node_view to rebuild filtered node body
-  unset($context['node']->body[$context['node']->language][0]['safe_value']);
-  unset($context['node']->body[$context['node']->language][0]['safe_summary']);
+  unset($body_field['safe_value']);
+  unset($body_field['safe_summary']);
 
   $context['node_body'] = $context['body'];
   $node_view = node_view($context['node']);
@@ -701,35 +683,35 @@ function contentanalysis_parse_context_node_edit($context, &$analysis) {
     }
     $context['body'] = $h . "\n" . $context['body'];
   }
-  
+
   $context['body_notags'] = strip_tags($context['body']);
-  
+
   if (!$context['page_title']) {
     $context['page_title'] = $context['title'];
-  } 
+  }
   if (is_null($context['path'])) {
     $path = 'node/' . $context['nid'];
     $path_alias = drupal_get_path_alias($path);
-    $context['path'] = ($path_alias)?$path_alias:$path;
+    $context['path'] = ($path_alias) ? $path_alias : $path;
   }
 
   if (is_null($context['url'])) {
     $url = 'http';
-    if ($_SERVER["HTTPS"] == "on") {
-      $url .= "s";
+    if ($_SERVER['HTTPS'] == 'on') {
+      $url .= 's';
+    }
+    $url .= '://';
+    if ($_SERVER['SERVER_PORT'] != '80') {
+      $url .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'];
     }
-    $url .= "://";
-    if ($_SERVER["SERVER_PORT"] != "80") {
-      $url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"];
-    } 
     else {
-      $url .= $_SERVER["SERVER_NAME"];
+      $url .= $_SERVER['SERVER_NAME'];
     }
     $url .= base_path();
     $url .= $context['path'];
     $context['url'] = $url;
   }
-  
+
   // get metatag context
   $context = contentanalysis_parse_context_metatags($context);
   return $context;
@@ -737,68 +719,62 @@ function contentanalysis_parse_context_node_edit($context, &$analysis) {
 
 /**
  * Normalizes context data inputed from the node_load function
- * 
+ *
  * @param $context
  *   Initialized context formated array
- * 
+ *
  * @return
  *   A normalized context array
  */
 function contentanalysis_parse_context_node_load($context, &$analysis) {
-	if (isset($context['node']) && is_object($context['node'])) {
-  	$node = $context['node'];
+  if (isset($context['node']) && is_object($context['node'])) {
+    $node = $context['node'];
   }
   elseif ($context['nid']) {
     $node = node_load($context['nid']);
     if (!$node) {
-    	$msg = t('Nid @nid is invalid.', array('@nid' => $context['nid']));
-    	$analysis['messages'][] = contentanalysis_format_message($msg, 'error');
-    	return $context;
+      $msg = t('Nid @nid is invalid.', array('@nid' => $context['nid']));
+      $analysis['messages'][] = contentanalysis_format_message($msg, 'error');
+      return $context;
     }
     $context['node'] = $node;
   }
   else {
     $msg = t('A valid node/nid was not submitted.');
     $analysis['messages'][] = contentanalysis_format_message($msg, 'error');
-  	return $context;
+    return $context;
   }
   $context['node_type'] = $node->type;
 
-  $context['title'] = (!is_null($context['title']))?$context['title']:$node->title;
+  $context['title'] = (!is_null($context['title'])) ? $context['title'] : $node->title;
 
   if (is_null($context['page_title'])) {
-    $context_title = $context['title'];
-    $context_page_title = $context['title'];
     if (module_exists('page_title')) {
-      $page_title_pattern = variable_get('page_title_type_'. (isset($node->type) ? $node->type : ''), '');
-  
+      $page_title_pattern = variable_get('page_title_type_' . (isset($node->type) ? $node->type : ''), '');
+
       if (empty($page_title_pattern)) {
         $page_title_pattern = variable_get('page_title_default', '[current-page:page-title] | [site:name]');
       }
-      
-      //$page_title_pattern = str_replace('[page-title]', (($context_page_title && (!is_null($context_page_title)))?$context_page_title:$context_title), $page_title_pattern);
-      //$page_title_pattern = str_replace('[title]', check_plain($context_title), $page_title_pattern);
-      //$page_title_pattern = str_replace('[title-raw]', $context_title, $page_title_pattern);
-  
+
       $types = array();
-  
+
       if (isset($node)) {
         $types['node'] = $node;
       }
-  
+
       $types['page_title'] = NULL;
       $context['page_title'] = token_replace($page_title_pattern, $types);
     }
-  } 
+  }
   else {
-    $context['page_title'] = ($context['title'])?$context['title']:$node->title;
+    $context['page_title'] = ($context['title']) ? $context['title'] : $node->title;
   }
- 
+
   $context['node_body'] = $context['body'];
   $node_view = node_view($context['node']);
 
   $context['body'] = $node_view['body'][0]['#markup'];
-  
+
   // prepend node title
   if (variable_get('contentanalysis_node_parse_nodetitle_prepend', CONTENTANALYSIS_NODE_PARSE_NODETITLE_PREPEND_DEFAULT)) {
     $h = $context['title'];
@@ -806,16 +782,16 @@ function contentanalysis_parse_context_node_load($context, &$analysis) {
     if (strpos($p, '[node:title]') !== FALSE) {
       $h = str_replace('[node:title]', $h, $p);
     }
-    $context['body'] = $h . "\n" . $context['body'];
+    $context['body'] = $h . '\n' . $context['body'];
   }
-  
+
   if (is_null($context['body_notags'])) {
     $context['body_notags'] = strip_tags($context['body']);
-  }  
-  
+  }
+
   // get metatag context
   if (isset($node->metatags['keywords']['value'])) {
-  	$context['meta_keywords'] = $node->metatags['keywords']['value'];
+    $context['meta_keywords'] = $node->metatags['keywords']['value'];
   }
   if (isset($node->metatags['description']['value'])) {
     $context['meta_description'] = $node->metatags['description']['value'];
@@ -825,20 +801,20 @@ function contentanalysis_parse_context_node_load($context, &$analysis) {
   if (is_null($context['path'])) {
     $path = 'node/' . $context['nid'];
     $path_alias = drupal_get_path_alias($path);
-    $context['path'] = ($path_alias)?$path_alias:$path;
+    $context['path'] = ($path_alias) ? $path_alias : $path;
   }
 
   if (is_null($context['url'])) {
     $url = 'http';
-    if (isset($_SERVER["HTTPS"]) && ($_SERVER["HTTPS"] == "on")) {
-      $url .= "s";
+    if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) {
+      $url .= 's';
+    }
+    $url .= '://';
+    if ($_SERVER['SERVER_PORT'] != '80') {
+      $url .= $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'];
     }
-    $url .= "://";
-    if ($_SERVER["SERVER_PORT"] != "80") {
-      $url .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"];
-    } 
     else {
-      $url .= $_SERVER["SERVER_NAME"];
+      $url .= $_SERVER['SERVER_NAME'];
     }
     $url .= base_path();
     $url .= $context['path'];
@@ -850,36 +826,32 @@ function contentanalysis_parse_context_node_load($context, &$analysis) {
 
 /**
  * Normalizes context data inputed as a complete xHTML document
- * 
- * @param $the_context
- *   Initialized context formated array
- * 
- * @return
- *   A normalized context array
+ *
+ * @param $context
+ *  Initialized context formated array
+ * @param $analysis
+ *
+ * @return array A normalized context array
  */
 function contentanalysis_parse_context_page($context, &$analysis) {
-//print "contentanalysis_parse_context_page($context)";
-//print_r($context);
   if (!$context['page']) {
     return $context;
   }
-  $count = preg_match('/<title>(.+?)<\/title>/isx', $context['page'], $match); 
-  $context['page_title'] =  $match[1];
-  //$count = preg_match('/(<meta name="keywords" content="(.*)" \/>)/i', $context['page'] ,$match);  // value in $match [2]
+  $count = preg_match('/<title>(.+?)<\/title>/isx', $context['page'], $match);
+  $context['page_title'] = $match[1];
   $count = preg_match("|<meta[^>]*keywords[^>]*content=\"([^>]+)\"[^>]*>|Ui", $context['page'], $match);
-  $context['meta_keywords'] =  $match[1];
-  //$count = preg_match('/(<meta name=\"description\" content="(.*)" \/>)/i', $context['page'], $match); // value in $match [2]
+  $context['meta_keywords'] = $match[1];
   $count = preg_match("|<meta[^>]*description[^>]*content=\"([^>]+)\"[^>]*>|Ui", $context['page'], $match);
-  $context['meta_description'] =  $match[1];
-  $count = preg_match('/(<body.*>)(.+?)(<\/body>)/ismU', $context['page'], $match); 
-  $context['body'] =  $match[2];
+  $context['meta_description'] = $match[1];
+  $count = preg_match('/(<body.*>)(.+?)(<\/body>)/ismU', $context['page'], $match);
+  $context['body'] = $match[2];
   $context['body_notags'] = strip_tags($context['body']);
-  
+
   return $context;
 }
 
 function contentanalysis_parse_context_metatags($context) {
-	if (module_exists('metatag')) {
+  if (module_exists('metatag')) {
     $options = array(
       'entity_type' => 'node',
       'entity' => $context['node'],
@@ -891,7 +863,7 @@ function contentanalysis_parse_context_metatags($context) {
     );
     $metatags = array();
     if (trim($context['meta_title'])) {
-    	$metatags['title'] = array(
+      $metatags['title'] = array(
         'value' => $context['meta_title'],
       );
     }
@@ -905,12 +877,12 @@ function contentanalysis_parse_context_metatags($context) {
         'value' => $context['meta_description'],
       );
     }
-    
-    $nodemeta = metatag_metatags_view('node:' . $context['node']->type , $metatags, $options); 
-    $globalmeta = metatag_metatags_view('global', array(), $options); 
+
+    $nodemeta = metatag_metatags_view('node:' . $context['node']->type, $metatags, $options);
+    $globalmeta = metatag_metatags_view('global', array(), $options);
 
     if (isset($nodemeta['title']['#attached']['metatag_set_preprocess_variable'][0][2])) {
-      $context['meta_title'] = $nodemeta['title']['#attached']['metatag_set_preprocess_variable'][0][2]; 
+      $context['meta_title'] = $nodemeta['title']['#attached']['metatag_set_preprocess_variable'][0][2];
     }
     if (isset($nodemeta['keywords']['#attached']['drupal_add_html_head'][0][0]['#value'])) {
       $context['meta_keywords'] = $nodemeta['keywords']['#attached']['drupal_add_html_head'][0][0]['#value'];
@@ -919,14 +891,14 @@ function contentanalysis_parse_context_metatags($context) {
       $context['meta_description'] = $nodemeta['description']['#attached']['drupal_add_html_head'][0][0]['#value'];
     }
     if (!$context['meta_keywords'] && isset($globalmeta['keywords']['#attached']['drupal_add_html_head'][0][0]['#value'])) {
-    	$context['meta_keywords'] = $globalmeta['keywords']['#attached']['drupal_add_html_head'][0][0]['#value'];
+      $context['meta_keywords'] = $globalmeta['keywords']['#attached']['drupal_add_html_head'][0][0]['#value'];
     }
     if (!$context['meta_description'] && isset($globalmeta['description']['#attached']['drupal_add_html_head'][0][0]['#value'])) {
       $context['meta_description'] = $globalmeta['description']['#attached']['drupal_add_html_head'][0][0]['#value'];
     }
   }
-  else if(!isset($context['meta_title'])) {
-  	$context['meta_title'] = $context['title'];
+  elseif (!isset($context['meta_title'])) {
+    $context['meta_title'] = $context['title'];
   }
   return $context;
 }
@@ -937,7 +909,7 @@ function contentanalysis_get_analyzer_settings($analyzer_name) {
   $all_settings = variable_get('contentanalysis_analyzer_settings', array());
   if (isset($all_settings[$analyzer_name]) && is_array($all_settings[$analyzer_name])) {
     $settings = $all_settings[$analyzer_name];
-  }	
+  }
   if (isset($analyzer_defs[$analyzer_name]['settings'])) {
     $settings += $analyzer_defs[$analyzer_name]['settings'];
   }
@@ -946,17 +918,18 @@ function contentanalysis_get_analyzer_settings($analyzer_name) {
 
 /**
  * Provides analysis on context passed in
- * 
+ *
  * - Normalizes the context
  * - Passes context to analyzer modules' "callback" declaired in analyzer definition
- * 
- * @param unknown_type $context
- * @param unknown_type $analyzers
- * @param unknown_type $analyzers_params
+ *
+ * @param $context
+ * @param $analyzers
+ * @param $analyzers_params
+ * @return array
  */
 function contentanalysis_do_analysis($context, $analyzers = NULL, $analyzers_params = array()) {
-  $analysis = array();  
-	$analysis_struc = array(
+  $analysis = array();
+  $analysis_struc = array(
     '#title' => '',
     '#status' => 'status',
     'content' => array(),
@@ -966,10 +939,10 @@ function contentanalysis_do_analysis($context, $analyzers = NULL, $analyzers_par
     'page_title' => array('#title' => t('Page title'), '#status' => 'status'),
     'body' => array('#title' => t('Body'), '#status' => 'status'),
     'meta_keywords' => array('#title' => t('Meta keywords'), '#status' => 'status'),
-    'meta_description' => array('#title' => t('Meta description'), '#status' => 'status'), 
+    'meta_description' => array('#title' => t('Meta description'), '#status' => 'status'),
   );
   // change structure if content is directly inputed without a full page
-  
+
   if ($context['source'] == 'admin') {
     if (!$context['inputs']['nid'] && !$context['inputs']['body'] && !$context['inputs']['url']) {
       $analysis = $analysis_struc;
@@ -977,23 +950,22 @@ function contentanalysis_do_analysis($context, $analyzers = NULL, $analyzers_par
       return $analysis;
     }
   }
-  
+
   $context = contentanalysis_parse_context($context, $analysis);
 
   // get analyzer settings
-  foreach($analyzers AS $analyzer_name => $analyzer) {
-  	$settings = contentanalysis_get_analyzer_settings($analyzer_name);
-  	$context['analyzers'][$analyzer_name]['settings'] = $settings;
+  foreach ($analyzers AS $analyzer_name => $analyzer) {
+    $settings = contentanalysis_get_analyzer_settings($analyzer_name);
+    $context['analyzers'][$analyzer_name]['settings'] = $settings;
   }
- 
+
   // allow modules to alter context
-  //drupal_alter('contentanalysis_context_parser', $context);
   drupal_alter('contentanalysis_context', $context, $analyzers);
 
   // save data to db 
   $save = isset($context['options']['dontsave']) ? 0 : 1;
   $context['aid'] = contentanalysis_get_aid($context, $save);
-  
+
   // change section labels if content is directly inputed
   if (($context['source'] == 'admin-form') && is_null($context['inputs']['url']) && is_null($context['inputs']['nid'])) {
     $analysis_struc['body']['#title'] = t('Text');
@@ -1002,13 +974,13 @@ function contentanalysis_do_analysis($context, $analyzers = NULL, $analyzers_par
     unset($analysis_struc['meta_keywords']);
     unset($analysis_struc['meta_description']);
   }
-  
-  
+
+
   $analysis['#context'] = $context;
 
   foreach ($analyzers AS $aid => $analyzer) {
     $analysis_struc['#title'] = $analyzer['title'];
-    $analysis[$aid] = call_user_func($analyzer['callback'], $context, $analysis_struc, isset($analyzers_params[$aid]) ? $analyzers_params[$aid] : NULL);  
+    $analysis[$aid] = call_user_func($analyzer['callback'], $context, $analysis_struc, isset($analyzers_params[$aid]) ? $analyzers_params[$aid] : NULL);
   }
 
   // do quickstart analysis if no analyzers are enabled
@@ -1017,14 +989,14 @@ function contentanalysis_do_analysis($context, $analyzers = NULL, $analyzers_par
     $analysis['contentanalysis'] = contentanalysis_checklist_analyzer($context, $analysis_struc);
   }
 
-  drupal_alter('contentanalysis_analysis', $analysis, $context);  
+  drupal_alter('contentanalysis_analysis', $analysis, $context);
 
   return $analysis;
 }
 
 /**
  * Generates checklist analyzer
- * 
+ *
  * @param $context
  *   A context formated array
  * @param $analysis
@@ -1081,8 +1053,8 @@ function contentanalysis_checklist_analyzer($context, $analysis) {
   foreach ($modules AS $module) {
     $status = 'status';
     $msg_vars = array(
-      '@module_name' => $module['name'],
-      '!enabled_status' => '',   
+      '%module_name' => $module['name'],
+      '!enabled_status' => '',
     );
     if (module_exists($module['module'])) {
       $msg_vars['!enabled_status'] = t('enabled');
@@ -1090,7 +1062,7 @@ function contentanalysis_checklist_analyzer($context, $analysis) {
       if ($module['recommended']) {
         $status = 'pass';
       }
-    } 
+    }
     else {
       $msg_vars['!enabled_status'] = t('not enabled');
       $link = l(t('Click here to download.'), $module['link'], array('target' => '_drupalorg'));
@@ -1098,20 +1070,20 @@ function contentanalysis_checklist_analyzer($context, $analysis) {
         $status = 'warning';
       }
     }
-    $msg = t('<strong>@module_name</strong> is !enabled_status.', $msg_vars);
+    $msg = t('%module_name is !enabled_status.', $msg_vars);
     if ($link) {
       $msg .= ' ' . $link;
-    }    
+    }
     $analysis['messages'][] = contentanalysis_format_message($msg, $status);
     $analysis['messages'][] = contentanalysis_format_message($module['description'], 'status');
   }
-  
-  return $analysis; 
+
+  return $analysis;
 }
 
 /**
  * Readies analysis elements such as stats and messages as markup output
- * 
+ *
  * @param $analysis
  *   contentanalysis formated analysis array
  */
@@ -1120,8 +1092,8 @@ function contentanalysis_build_analysis_content($analysis) {
   $ignore_keys = array('content', 'context', 'stats', 'tests', 'messages');
   // create status messages table
   foreach ($analysis AS $aid => $analysisi) {
-    if (substr($aid, 0, 1)=='#' || !is_array($analysisi)) { 
-      continue; 
+    if (substr($aid, 0, 1) == '#' || !is_array($analysisi)) {
+      continue;
     }
 
     $content = theme_contentanalysis_status_report($analysisi);
@@ -1132,10 +1104,9 @@ function contentanalysis_build_analysis_content($analysis) {
     // construct content for section analysis
     $analysis[$aid]['sections'] = array();
     foreach ($analysisi AS $sid => $analysisis) {
-      if ((substr($sid, 0, 1)=='#') || in_array($sid, $ignore_keys)  ) { 
-        continue; 
+      if ((substr($sid, 0, 1) == '#') || in_array($sid, $ignore_keys)) {
+        continue;
       }
-      $content = '';
       $analysis[$aid]['sections'][] = $sid;
       $content = theme_contentanalysis_status_report($analysisi, $sid);
       if ($content) {
@@ -1145,58 +1116,56 @@ function contentanalysis_build_analysis_content($analysis) {
         $analysis[$aid][$sid]['content'][] = array(
           '#value' => $content,
           '#weight' => 0,
-        );   
-      }   
-    }   
+        );
+      }
+    }
   }
-  
-  $tabs = '';
-  $con = '';
+
   foreach ($analysis AS $aid => $analysisi) {
     $ti = 0;
-    if (substr($aid, 0, 1)=='#' || !is_array($analysisi)) {
+    if (substr($aid, 0, 1) == '#' || !is_array($analysisi)) {
       continue;
     }
     $analysis[$aid]['output'] = '<div id="contentanalysis-report-' . $aid . '" class="contentanalysis-report">';
-    if (isset($analysisi['content'][0]['#tab']) && $analysisi['content'][0]['#tab']) {      
+    if (isset($analysisi['content'][0]['#tab']) && $analysisi['content'][0]['#tab']) {
       $tabs = '<h3 id="contentanalysis-report-tab-' . $aid . '-0" class="contentanalysis-report-tab">' . $analysisi['content'][0]['#value'] . "</h3>\n";
-    } 
+    }
     else {
       $tabs = '<h3 id="contentanalysis-report-tab-' . $aid . '-0" class="contentanalysis-report-tab">' . t('Report') . "</h3>\n";
     }
-    
+
     uasort($analysisi['content'], "element_sort");
     $i = 0;
-    $con = '<div id="contentanalysis-report-results-' . $aid . '-' . $ti .'" class="contentanalysis-results-section">';
+    $con = '<div id="contentanalysis-report-results-' . $aid . '-' . $ti . '" class="contentanalysis-results-section">';
     foreach ($analysisi['content'] AS $item) {
       if (isset($item['#tab']) && $item['#tab']) {
-        if ($i==0) {
+        if ($i == 0) {
           continue;
         }
         $ti++;
         $con .= '</div>';
-        $tabs .= '<h3  id="contentanalysis-report-tab-' . $aid . '-' . $ti .'" class="contentanalysis-report-tab">' . $item['#value'] . "</h3>\n";
-        $con .= '<div id="contentanalysis-report-results-' . $aid . '-' . $ti .'" class="contentanalysis-results-section">';
-        
-      } 
+        $tabs .= '<h3 id="contentanalysis-report-tab-' . $aid . '-' . $ti . '" class="contentanalysis-report-tab">' . $item['#value'] . "</h3>\n";
+        $con .= '<div id="contentanalysis-report-results-' . $aid . '-' . $ti . '" class="contentanalysis-results-section">';
+
+      }
       else {
         $con .= $item['#value'];
       }
       $i++;
     }
     $con .= '</div>';
-    
+
     $analysis[$aid]['output'] .= '<div id="contentanalysis-report-tabs-' . $aid . '" class="contentanalysis-report-tabs">';
     $analysis[$aid]['output'] .= $tabs;
     $analysis[$aid]['output'] .= '</div>';
     $analysis[$aid]['output'] .= '<div id="contentanalysis-report-results-' . $aid . '" class="contentanalysis-results">';
     $analysis[$aid]['output'] .= $con;
     $analysis[$aid]['output'] .= '</div>';
-    
+
     $analysis[$aid]['output'] .= "</div>\n";
     foreach ($analysisi['sections'] AS $sid) {
-      if (!isset($analysisi[$sid]['content']) || !is_array($analysisi[$sid]['content'])) { 
-        continue; 
+      if (!isset($analysisi[$sid]['content']) || !is_array($analysisi[$sid]['content'])) {
+        continue;
       }
       uasort($analysisi[$sid]['content'], "element_sort");
       $analysis[$aid][$sid]['output'] = '';
@@ -1206,89 +1175,94 @@ function contentanalysis_build_analysis_content($analysis) {
     }
   }
 
-  return $analysis; 
+  return $analysis;
 
 }
 
 /**
  * Themes the content analysis
- * 
+ *
  * @param $analysis
  *   contentanalysis formated analysis array
- * 
- * @return
- *  Themed content analysis
+ *
+ * @return string Themed content analysis
  */
-function theme_contentanalysis_analysis($analysis) { 
+function theme_contentanalysis_analysis($analysis) {
   $titles = array();
   $bodies = array();
   if (count($analysis['#context']['messages']) > 0) {
-    //$titles[] = '<h3 class="analyzer">'.t('Messages')."</h3>\n";;
     $bodies[] = theme_contentanalysis_messages($analysis['#context']['messages']);
   }
   foreach ($analysis AS $aid => $analysisi) {
-    if (!is_array($analysisi) || (substr($aid, 0, 1) == '#')) { 
-      continue;  
+    if (!is_array($analysisi) || (substr($aid, 0, 1) == '#')) {
+      continue;
     }
     $titles[] = '<h3 id="contentanalysis-analyzer-tab-' . $aid . '" class="analyzer">' . $analysisi['#title'] . "</h3>\n";
     $bodies[] = '<div class="analyzer-analysis"><h2>' . $analysisi['#title'] . '</h2>' . $analysisi['output'] . '</div>';
   }
 
   $out = '<h2 class="analyzers">Analyzers</h2>';
-  $out .= '<div class="analyzers">'. implode($titles) . '</div>';
-  $out .= '<div class="analysis-results">'. implode($bodies) . '</div>';
+  $out .= '<div class="analyzers">' . implode($titles) . '</div>';
+  $out .= '<div class="analysis-results">' . implode($bodies) . '</div>';
   return $out;
 }
 
 /**
  * Themes the contentanalysis sections
- * 
+ *
  * @param $analysis
  *   contentanalysis formated analysis array
  * @param $section
  *   string name of section [body|title|meta_description|meta_keyowrd]
- * @return
- *   Themed content analysis section
+ *
+ * @return bool|string Themed content analysis section
  */
 function theme_contentanalysis_section_analysis($analysis, $section) {
-  
+
   if ($analysis['#context']['inputs']['action'] != 'refresh') {
     $form['report-' . $section] = array(
-      '#type' => 'fieldset',      
-      '#title' => t('Content analysis report'),      
-      '#collapsible' => TRUE,      
-      '#collapsed' => FALSE,   
-      '#attributes' => array('class' => array('contentanalysis_section_analysis', 'analysis-results', 'contentanalysis-results')),
+      '#type' => 'fieldset',
+      '#title' => t('Content analysis report'),
+      '#collapsible' => TRUE,
+      '#collapsed' => FALSE,
+      '#attributes' => array(
+        'class' => array(
+          'contentanalysis_section_analysis',
+          'analysis-results',
+          'contentanalysis-results'
+        )
+      ),
     );
   }
-  $i=0;
+  $i = 0;
   foreach ($analysis AS $aid => $analysisi) {
-    if (!is_array($analysisi) || (substr($aid, 0, 1) == '#') || !is_array($analysisi[$section])  || !isset($analysisi[$section]['output'])) { 
-      continue;  
-    } 
+    if (!is_array($analysisi) || (substr($aid, 0, 1) == '#') || !is_array($analysisi[$section]) || !isset($analysisi[$section]['output'])) {
+      continue;
+    }
     $img = base_path() . '/' . drupal_get_path('module', 'contentanalysis') . '/icons/refresh.png';
-    $form['report-' . $section][$aid . '-report'] = array(    
-      '#type' => 'item',    
-      '#title' => $analysisi['#title'],    
+    $form['report-' . $section][$aid . '-report'] = array(
+      '#type' => 'item',
+      '#title' => $analysisi['#title'],
       '#markup' => $analysisi[$section]['output'],
-      '#prefix' => '<div id="contentanalysis-report-' . $aid . '-' . $section .'" class="contentanalysis-report-' . $aid . ' contentanalysis-report-' . $aid . '-' . $section .'">',
+      '#prefix' => '<div id="contentanalysis-report-' . $aid . '-' . $section . '" class="contentanalysis-report-' . $aid . ' contentanalysis-report-' . $aid . '-' . $section . '">',
       '#suffix' => '</div>',
       '#weight' => $i++,
-    );   
+    );
   }
-  
-  $output = $i ? drupal_render($form) : '';  
-  
+
+  $output = $i ? drupal_render($form) : '';
+
   return $output;
 }
 
 /**
  * Theming function for analysis status report
- * 
+ *
  * @param $analysisi
  *   Content analysis analyzer elements array, e.g. $analysis['seo']
  * @param $show
  *   Sections to include. Values: [all|general|sections|page_title|body|meta_keywords|meta_description]
+ *
  * @return
  *   Themed status report table
  */
@@ -1299,60 +1273,60 @@ function theme_contentanalysis_status_report($analysisi, $show = 'all') {
   if (($show == 'all') || ($show == 'general')) {
     $stats = isset($analysisi['stats']) ? theme_contentanalysis_analysis_stats($analysisi['stats']) : '';
     $msgs = isset($analysisi['messages']) ? theme_contentanalysis_analysis_messages($analysisi['messages']) : '';
-    $status = (isset($analysisi['#status'])) ? $analysisi['#status']:'status';
+    $status = (isset($analysisi['#status'])) ? $analysisi['#status'] : 'status';
     if ($stats || $msgs) {
       $rows[] = array(
         array(
-          'data' => t('General'), 
+          'data' => t('General'),
           'class' => array('section', $status),
         ),
         array(
-          'data' => $stats . $msgs, 
+          'data' => $stats . $msgs,
           'class' => array('messages')
         )
       );
-    }    
+    }
   }
   if (($show == 'all') || ($show == 'sections')) {
     foreach ($analysisi AS $sid => $analysisis) {
-      $stats = isset($analysisis['stats']) ?  theme_contentanalysis_analysis_stats($analysisis['stats']) : '';
+      $stats = isset($analysisis['stats']) ? theme_contentanalysis_analysis_stats($analysisis['stats']) : '';
       $msgs = isset($analysisis['messages']) ? theme_contentanalysis_analysis_messages($analysisis['messages']) : '';
-      $status = (isset($analysisis['#status']) && $analysisis['#status']) ? $analysisis['#status'] : 'status';      
+      $status = (isset($analysisis['#status']) && $analysisis['#status']) ? $analysisis['#status'] : 'status';
       if ($stats || $msgs) {
         $rows[] = array(
           array(
-            'data' => $analysisis['#title'], 
+            'data' => $analysisis['#title'],
             'class' => array('section', $status),
-          ), 
+          ),
           array(
             'data' => $stats . $msgs,
             'class' => array('messages'),
           )
-        );        
+        );
       }
     }
-  } 
+  }
   elseif ($analysisis = $analysisi[$show]) {
-    $stats = isset($analysisis['stats']) ?  theme_contentanalysis_analysis_stats($analysisis['stats']) : '';
+    $stats = isset($analysisis['stats']) ? theme_contentanalysis_analysis_stats($analysisis['stats']) : '';
     $msgs = isset($analysisis['messages']) ? theme_contentanalysis_analysis_messages($analysisis['messages']) : '';
-    $status = (isset($analysisis['#status']) && $analysisis['#status']) ? $analysisis['#status'] : 'status'; 
+    $status = (isset($analysisis['#status']) && $analysisis['#status']) ? $analysisis['#status'] : 'status';
     if ($stats || $msgs) {
       $rows[] = array(
         array(
-          'data' => $analysisis['#title'], 
+          'data' => $analysisis['#title'],
           'class' => array('section', $status)
         ),
         array(
           'data' => $stats . $msgs,
           'class' => array('messages'),
         ),
-      );       
-    }  
+      );
+    }
   }
   if (count($rows) > 0) {
     $header = array(array('data' => t('Sections')), array('data' => t('Analysis')));
-  
-    $vars= array(
+
+    $vars = array(
       'header' => $header,
       'rows' => $rows,
       'attributes' => array('class' => array('status_report')),
@@ -1364,9 +1338,9 @@ function theme_contentanalysis_status_report($analysisi, $show = 'all') {
 
 /**
  * Theses analysis report stats elements into output
- * 
+ *
  * @param $stats
- *   Analysis stats formated associative array formated by 
+ *   Analysis stats formated associative array formated by
  *   contentanalysis_format_stat()
  * @return
  *   Themed stats section
@@ -1375,19 +1349,19 @@ function theme_contentanalysis_analysis_stats($stats) {
   if (!$stats || !is_array($stats)) {
     return '';
   }
-  $output = '<div class="contentanalysis_stats">'."\n";
-  $i=0;
+  $output = '<div class="contentanalysis_stats">' . "\n";
+  $i = 0;
   foreach ($stats AS $sid => $item) {
-    $output .= (($i)?', ':'') . $item['#title'] . '=' . number_format($item['#value'], (($item['#decimals'])?$item['#decimals']:0));   
-    $i++; 
+    $output .= (($i) ? ', ' : '') . $item['#title'] . '=' . number_format($item['#value'], (($item['#decimals']) ? $item['#decimals'] : 0));
+    $i++;
   }
-  $output .= "</div>\n";  
+  $output .= "</div>\n";
   return $output;
 }
 
 /**
  * Themes analysis report messages into output
- * 
+ *
  * @param $stats
  *   Analysis messages formated associative array formated by
  *   contentanalysis_format_message()
@@ -1399,7 +1373,7 @@ function theme_contentanalysis_analysis_messages($msgs) {
     return '';
   }
   foreach ($msgs AS $mid => $item) {
-    $items[] = array('class' => array($item['#status']), 'data' => $item['#value']);    
+    $items[] = array('class' => array($item['#status']), 'data' => $item['#value']);
   }
   $vars = array(
     'items' => $items,
@@ -1413,7 +1387,7 @@ function theme_contentanalysis_analysis_messages($msgs) {
 
 /**
  * Themes status messages into output
- * 
+ *
  * @param $stats
  *   Messages formated associative arrayformated by
  *   contentanalysis_format_message()
@@ -1443,7 +1417,7 @@ function theme_contentanalysis_messages($msgs) {
  * @return
  *   Stats formated associative array
  */
-function contentanalysis_format_stat($title, $value, $decimals=0) {
+function contentanalysis_format_stat($title, $value, $decimals = 0) {
   return array(
     '#title' => $title,
     '#value' => $value,
@@ -1460,7 +1434,7 @@ function contentanalysis_format_stat($title, $value, $decimals=0) {
  * @return
  *   Message formated associative array
  */
-function contentanalysis_format_message($message, $type='status') {
+function contentanalysis_format_message($message, $type = 'status') {
   return array(
     '#value' => $message,
     '#status' => $type,
@@ -1490,28 +1464,26 @@ function contentanalysis_format_content($value, $weight = -1, $tab = FALSE) {
 }
 
 /**
- * Implementation of hook_form_alter().
+ * Implements hook_form_alter().
  *
  * Add Content Optimizer field set to node edit forms.
  * Add Content Analysis enabled field to content type admin form
  */
 function contentanalysis_form_alter(&$form, &$form_state, $form_id) {
-  if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id && variable_get('contentanalysis_type_' . $form['#node']->type . '_enable', 1)) {
+  if (isset($form['type']['#value']) && $form['type']['#value'] . '_node_form' == $form_id && variable_get('contentanalysis_type_' . $form['#node']->type . '_enable', 1)) {
     if (!user_access('perform content analysis')) {
       return '';
     }
     $node = $form['#node'];
-    
-    //$form['contentanalysis'] = contentanalysis_node_form($form_state, array(), $node, $settings);
+
     $form['contentanalysis'] = array(
       '#type' => 'fieldset',
       '#title' => t('Content analysis'),
       '#collapsible' => TRUE,
       '#collapsed' => variable_get('contentanalysis_node_edit_form_collapsed', 0),
-      //'#attributes' => array('class' => 'contentanalysis'),
       '#group' => 'additional_settings',
     );
-    
+
     $form['contentanalysis'] = array_merge($form['contentanalysis'], contentanalysis_analysis_form($form_state, array(), $node, 'node-edit'));
     $form['#submit'][] = 'contentanalysis_node_submit';
   }
@@ -1531,19 +1503,19 @@ function contentanalysis_form_alter(&$form, &$form_state, $form_id) {
       '#options' => array(
         'enable' => t('Enable'),
       ),
-      '#default_value' => variable_get('contentanalysis_type_'. $form['#node_type']->type .'_enable', 1) ? array('enable') : array(),
-    ); 
-/* TODO get analyzer settings working at node_type level
-    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'contentanalysis') . "/contentanalysis.admin.inc";
-    $form['contentanalysis'] = array_merge($form['contentanalysis'], contentanalysis_admin_analyzer_settings_element($mode = 'node_type'));
-*/  
+      '#default_value' => variable_get('contentanalysis_type_' . $form['#node_type']->type . '_enable', 1) ? array('enable') : array(),
+    );
+    /* TODO get analyzer settings working at node_type level
+        require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'contentanalysis') . "/contentanalysis.admin.inc";
+        $form['contentanalysis'] = array_merge($form['contentanalysis'], contentanalysis_admin_analyzer_settings_element($mode = 'node_type'));
+    */
     $form['#submit'][] = 'contentanalysis_node_type_form_submit';
   }
 }
 
 /**
  * Enables/disables content analysis on content type admin form
- * 
+ *
  * @param $form
  *   standard form_api form array
  * @param $form_state
@@ -1551,60 +1523,56 @@ function contentanalysis_form_alter(&$form, &$form_state, $form_id) {
  */
 function contentanalysis_node_type_form_submit($form, &$form_state) {
   $enable = ($form_state['values']['contentanalysis']['enable']['enable']) ? 1 : 0;
-  variable_set('contentanalysis_type_'. $form_state['values']['type'] .'_enable', $enable);
+  variable_set('contentanalysis_type_' . $form_state['values']['type'] . '_enable', $enable);
 }
 
 /**
- * Trigers analyzer node form submit callback on node edit submission
+ * Triggers analyzer node form submit callback on node edit submission
  * @param $form
  *   standard form_api form array
  * @param $form_state
  *   standard form_api form_state array
  */
 function contentanalysis_node_submit($form, &$form_state) {
-//print "contentanalysis_node_submit($form, $form_state)";
-//print_r($form_state);
-  $analyzers = contentanalysis_analyzer_info();  
-  
+  $analyzers = contentanalysis_analyzer_info();
+
   foreach ($analyzers AS $aid => $analyzer) {
     if (isset($analyzer['node form submit callback'])) {
-      $analysis[$aid] = call_user_func($analyzer['node form submit callback'], $form, $form_state);   
+      $analysis[$aid] = call_user_func($analyzer['node form submit callback'], $form, $form_state);
     }
-  } 
+  }
 }
 
+/**
+ * Implements hook_block_info().
+ *
+ * Provides block for launching content analysis.
+ */
+function contentanalysis_block_info() {
+  $blocks['launch']['info'] = t('Content analysis');
+  $blocks['launch']['cache'] = DRUPAL_NO_CACHE;
+  return $blocks;
+}
 
-/*
-* Implementation of hook_block()
-* 
-* Provides block for launching content analysis.
-*/
-function contentanalysis_block($op = 'list', $delta = 0, $edit = array()) {
-  switch ($op) {
-    case 'list':
-      $blocks['launch']['info'] = t('Content analysis');
-      $blocks['launch']['cache'] = BLOCK_NO_CACHE;
-      return $blocks;
-  
-    case 'view':
-      if (
-        (arg(0) == 'admin') 
-        || ((arg(0) == 'node') && (is_numeric(arg(1))) && (arg(2) == 'edit'))
-        || !user_access('perform content analysis')
-        ) {
-        return '';
-      }
-      // don't display on node edit forms
-      if (!((arg(0) == 'node') && (arg(2) == 'edit') || (arg(1) == 'add'))) {
-        $block['content'] = drupal_get_form('contentanalysis_analysis_form', array(), array(), 'block');
-      } 
-      return $block;
+/**
+ * Implements hook_block_view().
+ */
+function contentanalysis_block_view($delta = '') {
+  $block = array();
+  if ($delta == 'launch') {
+    if (!((arg(0) == 'node') && ((arg(2) == 'edit') || (arg(1) == 'add')))
+      && (arg(0) != 'admin')
+      && user_access('perform content analysis')
+    ) {
+      $block['content'] = drupal_get_form('contentanalysis_analysis_form', array(), array(), 'block');
+    }
   }
+  return $block;
 }
 
 /**
  * Returns the aid for a given context
- * 
+ *
  * @param $context
  * @param $save
  *   Boolean to save the aid if it does not already exist
@@ -1613,7 +1581,6 @@ function contentanalysis_block($op = 'list', $delta = 0, $edit = array()) {
  */
 function contentanalysis_get_aid($context, $save = 0) {
   // save data to db 
-//watchdog('ca 1465', print_r($context, 1));
   $aid = NULL;
   $where = '';
   if (($context['source'] == 'node-edit-form') && (is_null($context['nid']))) {
@@ -1624,42 +1591,40 @@ function contentanalysis_get_aid($context, $save = 0) {
   if ($context['aid'] > 0) {
     $query->condition('aid', $context['aid']);
     $where = TRUE;
-  } 
+  }
   elseif ($context['nid'] > 0) {
-  	$query->condition('nid', $context['nid']);
-  	$where = TRUE;
-  } 
+    $query->condition('nid', $context['nid']);
+    $where = TRUE;
+  }
   elseif (!is_null($context['path'])) {
     $query->condition('path', $context['path']);
     $where = TRUE;
-  } 
+  }
   elseif (!is_null($context['url'])) {
     $query->condition('url', $context['url']);
     $where = TRUE;
-  } 
+  }
 
   if ($where && $save) { // by pass db save if analyzing content direct submission
-//watchdog('ca 1491', " " . $query);
     $result = $query->execute()->fetchObject();
     $fields = array(
-      'last_analysis' => time(),
+      'last_analysis' => REQUEST_TIME,
       'nid' => isset($context['nid']) && $context['nid'] ? $context['nid'] : 0,
       'path' => isset($context['path']) && $context['path'] ? $context['path'] : '',
       'url' => $context['url'],
-    );    
+    );
     if ($result && $result->aid) {
       $aid = $result->aid;
       db_update('contentanalysis')
         ->fields($fields)
         ->condition('aid', $result->aid)
         ->execute();
-    } 
+    }
     // check if all essential fields are set, then save
     elseif (isset($fields['url'])) {
       $context['last_analysis'] = REQUEST_TIME;
       $query = db_insert('contentanalysis')
         ->fields($fields);
-//watchdog('ca 1505', " " . $query);        
       $aid = $query->execute();
     }
   }
@@ -1668,11 +1633,11 @@ function contentanalysis_get_aid($context, $save = 0) {
 
 /**
  * Returns the aid for a given node id
- * 
+ *
  * @param $nid
  *   node id for the node of the analysis
- * @return
- *   aid
+ *
+ * @return int aid
  */
 function contentanalysis_get_aid_by_nid($nid) {
   $query = db_select('contentanalysis', 'ca')
@@ -1683,7 +1648,7 @@ function contentanalysis_get_aid_by_nid($nid) {
 
 /**
  * Returns the aid for a given url
- * 
+ *
  * @param $url
  *   url of an analysis
  * @return
@@ -1697,26 +1662,26 @@ function contentanalysis_get_aid_by_url($url) {
 }
 
 /**
- * Implements hook_node_delete
- * 
+ * Implements hook_node_delete().
+ *
  * @param $node
  */
-function contentanalysis_node_delete($node) {	
-	$aid = contentanalysis_get_aid_by_nid($node->nid);
-	// call analysis delete callbacks to enable analyzers to delete data
-	$analyzers = contentanalysis_analyzer_info();
+function contentanalysis_node_delete($node) {
+  $aid = contentanalysis_get_aid_by_nid($node->nid);
+  // call analysis delete callbacks to enable analyzers to delete data
+  $analyzers = contentanalysis_analyzer_info();
   foreach ($analyzers AS $name => $analyzer) {
-  	if (isset($analyzer['analysis delete callback'])) {
-      $analysis[$aid] = call_user_func($analyzer['analysis delete callback'], $aid);  
-  	}
+    if (isset($analyzer['analysis delete callback'])) {
+      $analysis[$aid] = call_user_func($analyzer['analysis delete callback'], $aid);
+    }
   }
   // delete contentanalysis records
   $query = db_delete('contentanalysis_status')
     ->condition('aid', $aid);
-  $query->execute(); 
+  $query->execute();
   $query = db_delete('contentanalysis')
     ->condition('aid', $aid);
-  $query->execute(); 
+  $query->execute();
 }
 
 function contentanalysis_analyzer_info() {
@@ -1729,7 +1694,7 @@ function contentanalysis_analyzer_info() {
     }
     else {
       $analyzers = array();
-      foreach (module_implements('contentanalysis_analyzer_info') as $module) {     
+      foreach (module_implements('contentanalysis_analyzer_info') as $module) {
         foreach (module_invoke($module, 'contentanalysis_analyzer_info') as $name => $analyzer) {
           // Ensure the current toolkit supports the element.
           $analyzer['module'] = $module;
@@ -1738,7 +1703,7 @@ function contentanalysis_analyzer_info() {
         }
       }
       // TODO used to support depricated hook naming convention (renamed to hook_analyzer_info above). Remove this after sufficent time.
-      foreach (module_implements('contentanalysis_analyzers') as $module) {     
+      foreach (module_implements('contentanalysis_analyzers') as $module) {
         foreach (module_invoke($module, 'contentanalysis_analyzers') as $name => $analyzer) {
           // Ensure the current toolkit supports the element.
           $analyzer['module'] = $module;
@@ -1750,5 +1715,5 @@ function contentanalysis_analyzer_info() {
       cache_set("contentanalysis_analyzers", $analyzers);
     }
   }
-  return $analyzers; 
+  return $analyzers;
 }
diff --git a/includes/seo_friend.inc b/includes/seo_friend.inc
index a1b5efe..b3c579d 100644
--- a/includes/seo_friend.inc
+++ b/includes/seo_friend.inc
@@ -1,77 +1,73 @@
 <?php
-// $Id: seo_friend.inc,v 1.1.2.2 2010/09/26 17:14:13 tomdude48 Exp $
 /**
- * @file * Admin include file. 
-*/
+ * @file * Admin include file.
+ */
 
 /**
- * Implementation of hook_seo_reports().
+ * Implements hook_seo_reports().
  */
 function contentanalysis_seo_reports() {
   return array(
     'contentanalysis' => array(
       'title' => 'Content Analysis',
       'callback' => 'contentanalysis_seo_friend_report',
-      ),
-    );
+    ),
+  );
 }
 
 function contentanalysis_seo_friend_report() {
   $use_pager = TRUE;
-  
+
   $analyzers_meta = module_invoke_all('contentanalysis_analyzers');
-  
+
   $analyzers = array();
   $rows = array();
-  
-  $sql = '
-	SELECT DISTINCT analyzer 
-	FROM {contentanalysis_status}
-  ';
+
+  $sql = 'SELECT DISTINCT analyzer FROM {contentanalysis_status}';
   $result = db_query($sql);
-  while($a = db_result($result)) {
-	$analyzers[$a] = $analyzers_meta[$a]['title'];
+  while ($a = db_result($result)) {
+    $analyzers[$a] = $analyzers_meta[$a]['title'];
   }
   $header = array(
-      array('data' => 'nid', 'field' => 'n.nid'),
-      array('data' => 'status', 'field' => 'n.status'),
-      array('data' => 'node title', 'field' => 'r.title'),
+    array('data' => 'nid', 'field' => 'n.nid'),
+    array('data' => 'status', 'field' => 'n.status'),
+    array('data' => 'node title', 'field' => 'r.title'),
   );
-  if(!is_array($analyzers)) {
+  if (!is_array($analyzers)) {
     drupal_set_message(t('No statuses have been reported by any content analyzers. To generate reports, click the "Analyze content" button from a node edit form.'), 'warning');
-	$analyzers = array();
+    $analyzers = array();
   }
-  else {  
-    foreach($analyzers AS $aid => $analyzer) {
-	  $header[] = array('data' => $analyzer, 'field' => 'as_' . $aid . '.statusi');
+  else {
+    foreach ($analyzers AS $aid => $analyzer) {
+      $header[] = array('data' => $analyzer, 'field' => 'as_' . $aid . '.statusi');
       $did = 'as_' . $aid;
       $a_join .= "LEFT JOIN {contentanalysis_status} AS $did ON a.aid = $did.aid AND $did.analyzer = \"$aid\"\n";
       $a_select .= ", $did.statusi AS {$aid}_statusi, $did.score AS {$aid}_score";
-    } 
-  }  
+    }
+  }
   $header[] = array('data' => t('ops'));
-  
+
   $nodes = array();
   $page_title_field = '';
   $page_title_join = '';
   if (module_exists('page_title')) {
     $page_title_field = ', p.page_title ';
-    $page_title_join = ' LEFT JOIN {page_title} AS p ON n.nid=p.'.seo_friend_get_page_title_id_column();
+    $page_title_join = ' LEFT JOIN {page_title} AS p ON n.nid=p.' . seo_friend_get_page_title_id_column();
   }
   $sql = '
       SELECT n.nid, n.status, n.type, r.title, n.sticky ' . $page_title_field . $a_select . ' 
       FROM {node} AS n
-	  LEFT JOIN {contentanalysis} AS a ON n.nid = a.nid
-	  ' . $a_join . '
+      LEFT JOIN {contentanalysis} AS a ON n.nid = a.nid
+      ' . $a_join . '
       INNER JOIN {node_revisions} AS r ON n.vid=r.vid ' . $page_title_join;
   $sql .= tablesort_sql($header);
   if ($use_pager) {
     $count_sql = '
       SELECT COUNT(n.nid) AS row_count
       FROM {node} AS n
-	  LEFT JOIN {contentanalysis} AS a ON n.nid = a.nid
-	  ' . $a_join . '
-      INNER JOIN {node_revisions} AS r ON n.vid=r.vid '.$page_title_join.
+      LEFT JOIN {contentanalysis} AS a ON n.nid = a.nid
+      ' . $a_join . '
+      INNER JOIN {node_revisions} AS r ON n.vid=r.vid ' . $page_title_join .
       tablesort_sql($header);
     $pager_num = seo_friend_get_number_variable(SEO_PAGER_NUM, 100);
     $result = pager_query($sql, $pager_num, 0, $count_sql);
@@ -80,52 +76,57 @@ function contentanalysis_seo_friend_report() {
   while ($r = db_fetch_object($result)) {
     $data = array();
 
-	$data[] = array('data' => $r->nid, 'class' => 'row-status');
-	$data[] = seo_friend_get_node_status($r);
-	$data[] = l($r->title, 'node/'.$r->nid);
-	foreach($analyzers AS $aid => $analyzer) {
+    $data[] = array('data' => $r->nid, 'class' => 'row-status');
+    $data[] = seo_friend_get_node_status($r);
+    $data[] = l($r->title, 'node/' . $r->nid);
+    foreach ($analyzers AS $aid => $analyzer) {
       $value = NULL;
       $class = NULL;
       $scoreh = $aid . '_score';
-	  $statush = $aid . '_statusi';
-	  if($r->$scoreh) {
-	    $dec = ($analyzers_meta[$aid]['score decimals']) ? $analyzers_meta[$aid]['score decimals'] : 1;
+      $statush = $aid . '_statusi';
+      if ($r->$scoreh) {
+        $dec = ($analyzers_meta[$aid]['score decimals']) ? $analyzers_meta[$aid]['score decimals'] : 1;
         $value = $analyzers_meta[$aid]['score prefix'] . number_format($r->$scoreh, $dec) . $analyzers_meta[$aid]['score suffix'];
       }
-      if(is_null($r->$statush)) {
-	    $value = ($value) ? $value : t('NA');
-		$class = 'status';	
-	  }
-	  else if($r->$statush == 2) {
+      if (is_null($r->$statush)) {
+        $value = ($value) ? $value : t('NA');
+        $class = 'status';
+      }
+      elseif ($r->$statush == 2) {
         $value = ($value) ? $value : t('OK');
-        $class = 'ok';		
+        $class = 'ok';
       }
-      else if($r->$statush == 1) {
+      elseif ($r->$statush == 1) {
         $value = ($value) ? $value : t('warn');
-		$class = 'warning';
+        $class = 'warning';
       }
-      else if($r->$statush == 0) {
+      elseif ($r->$statush == 0) {
         $value = ($value) ? $value : t('error');
-		$class = 'error';
-      }	
-	  $data[] = array(
-	    'data' => $value,
-		'class' => $class,
-	  );
-	}	
-	$data[] = l('Edit', 'node/'.$r->nid.'/edit');
-    $rows[] = array('data' =>
-      $data,
-      'class' => $duplicates ? 'error' : 'ok'
+        $class = 'error';
+      }
+      $data[] = array(
+        'data' => $value,
+        'class' => $class,
+      );
+    }
+    $data[] = l(t('Edit'), 'node/' . $r->nid . '/edit');
+    $rows[] = array(
+      'data' => $data,
+      'class' => $duplicates ? 'error' : 'ok',
     );
   }
 
   if (!$rows) {
-    $rows[] = array(array('data' => t('No keywords associated with this page.'), 'colspan' => count($header)));
-  }  
+    $rows[] = array(
+      array(
+        'data' => t('No keywords associated with this page.'),
+        'colspan' => count($header),
+      )
+    );
+  }
 
-  $output .= theme('table', $header, $rows, array('id' => 'kwresearch-site-keywords'));
+  $output = theme('table', $header, $rows, array('id' => 'kwresearch-site-keywords'));
   $output .= theme('pager', NULL, $pager_num, 0);
 
-  return $output;  
+  return $output;
 }
\ No newline at end of file
diff --git a/includes/theme.inc b/includes/theme.inc
index 8ee78dc..7dc160a 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -44,14 +44,14 @@ function contentanalysis_element_info() {
 function contentanalysis_theme($existing, $type, $theme, $path) {
   return array(
     'contentanalysis_slider_value' => array(
-       'render element' => 'element',
-       'template' => 'slider-value',
-       'path' => "$path/theme",
+      'render element' => 'element',
+      'template' => 'slider-value',
+      'path' => "$path/theme",
     ),
     'contentanalysis_slider_range' => array(
-       'render element' => 'element',
-       'template' => 'slider-range',
-       'path' => "$path/theme",
+      'render element' => 'element',
+      'template' => 'slider-range',
+      'path' => "$path/theme",
     ),
   );
 }
\ No newline at end of file
diff --git a/theme/slider-nojquery.tpl.php b/theme/slider-nojquery.tpl.php
index 4fee2d0..800d0f6 100644
--- a/theme/slider-nojquery.tpl.php
+++ b/theme/slider-nojquery.tpl.php
@@ -13,12 +13,16 @@
   <strong><?php echo $element["#title"];?>:</strong>
 </div>
 <div>
-<div class="description" style="margin-bottom:10px;"><?php echo $element["#description"];?></div>
-<?php if ($element['#type'] == 'seo_slider_at_least'): ?>
-&ge;&nbsp;<input type="text" size="<?php echo $element['#size'] ?>" name='<?php echo $element["#name"]; ?>' id='<?php echo $element["#id"];?>_value' value='<?php echo $element["#default"][0]; ?>' />&nbsp;%
-<?php else: ?>
-&#8712;&nbsp;[<input type="text" size="<?php echo $element['#size'] ?>" name='<?php echo $element["#name"]; ?>[]' id='<?php echo $element["#id"];?>_lower_value' value='<?php echo $element["#default"][0]; ?>' />&nbsp;%
-, <input type="text" size="<?php echo $element['#size'] ?>" name='<?php echo $element["#name"]; ?>[]' id='<?php echo $element["#id"];?>_upper_value' value='<?php echo $element["#default"][1]; ?>' />&nbsp;%
-]
-<?php endif; ?>
+  <div class="description" style="margin-bottom:10px;"><?php echo $element["#description"];?></div>
+  <?php if ($element['#type'] == 'seo_slider_at_least'): ?>
+  &ge;&nbsp;<input type="text" size="<?php echo $element['#size'] ?>" name='<?php echo $element["#name"]; ?>'
+                   id='<?php echo $element["#id"];?>_value' value='<?php echo $element["#default"][0]; ?>'/>&nbsp;%
+  <?php else: ?>
+  &#8712;&nbsp;[<input type="text" size="<?php echo $element['#size'] ?>" name='<?php echo $element["#name"]; ?>[]'
+                       id='<?php echo $element["#id"];?>_lower_value' value='<?php echo $element["#default"][0]; ?>'/>
+  &nbsp;%
+  , <input type="text" size="<?php echo $element['#size'] ?>" name='<?php echo $element["#name"]; ?>[]'
+           id='<?php echo $element["#id"];?>_upper_value' value='<?php echo $element["#default"][1]; ?>'/>&nbsp;%
+  ]
+  <?php endif; ?>
 </div>
\ No newline at end of file
diff --git a/theme/slider-range.tpl.php b/theme/slider-range.tpl.php
index b3e2559..cac7337 100644
--- a/theme/slider-range.tpl.php
+++ b/theme/slider-range.tpl.php
@@ -9,35 +9,41 @@
  * - $element: The element array containing #id, #name,...
  */
 ?>
-<?php if (isset($element["#title"])) : ?> 
+<?php if (isset($element["#title"])) : ?>
 <div>
   <strong><?php echo $element["#title"];?>:</strong>
 </div>
-<?php endif; ?> 
+<?php endif; ?>
 <div id="<?php echo $element["#id"]; ?>" class="slider-widget-container">
   <div style="float:left">
     <div id='<?php echo $element["#id"]; ?>_slider' class='ui-slider-1'></div>
   </div>
-  <span style="margin-left: 15px;"><?php if (isset($element["#slider_suffix"])) { echo $element["#slider_suffix"]; } ?><span id='<?php echo $element["#id"]; ?>_nr_0'><?php echo $element["#default"][0] . $element["#value_suffix"]; ?></span> - <span id='<?php echo $element["#id"]; ?>_nr_1'><?php echo $element["#default"][1] . $element["#value_suffix"]; ?></span></span>
+  <span style="margin-left: 15px;"><?php if (isset($element["#slider_suffix"])) {
+    echo $element["#slider_suffix"];
+  } ?><span
+    id='<?php echo $element["#id"]; ?>_nr_0'><?php echo $element["#default"][0] . $element["#value_suffix"]; ?></span> - <span
+    id='<?php echo $element["#id"]; ?>_nr_1'><?php echo $element["#default"][1] . $element["#value_suffix"]; ?></span></span>
 </div>
 <div style="clear:both;"></div>
 <script type="text/javascript">
-<!--
+  <!--
   jQuery('#<?php echo $element["#id"];?>_slider').slider({
-    slide: Sliders.changeHandle,
+    slide:Sliders.changeHandle,
     step: <?php echo $element["#step"]; ?>,
-    values: [
-      <?php echo $element["#default"][0]; ?>,
-      <?php echo $element["#default"][1]; ?>,      
+    values:[
+    <?php echo $element["#default"][0]; ?>,
+    <?php echo $element["#default"][1]; ?>,
     ],
     max: <?php echo $element["#max"]; ?>,
     min: <?php echo $element["#min"]; ?>,
-    range: true
-});
-//-->
+    range:true
+  });
+  //-->
 </script>
-<?php if (isset($element["#description"])) : ?> 
+<?php if (isset($element["#description"])) : ?>
 <div class="description" style="margin-bottom:10px;"><?php echo $element["#description"];?></div>
-<?php endif; ?> 
-<input type="hidden" name='<?php echo $element["#name"]; ?>[]' id='<?php echo $element["#id"];?>_value_0' value='<?php echo $element["#default"][0]; ?>' />
-<input type="hidden" name='<?php echo $element["#name"]; ?>[]' id='<?php echo $element["#id"];?>_value_1' value='<?php echo $element["#default"][1]; ?>' />
\ No newline at end of file
+<?php endif; ?>
+<input type="hidden" name='<?php echo $element["#name"]; ?>[]' id='<?php echo $element["#id"];?>_value_0'
+       value='<?php echo $element["#default"][0]; ?>'/>
+<input type="hidden" name='<?php echo $element["#name"]; ?>[]' id='<?php echo $element["#id"];?>_value_1'
+       value='<?php echo $element["#default"][1]; ?>'/>
\ No newline at end of file
diff --git a/theme/slider-value.tpl.php b/theme/slider-value.tpl.php
index e00374d..0e39988 100644
--- a/theme/slider-value.tpl.php
+++ b/theme/slider-value.tpl.php
@@ -10,30 +10,34 @@
  */
 
 ?>
-<?php if (isset($element["#title"])) : ?> 
+<?php if (isset($element["#title"])) : ?>
 <div>
   <strong><?php echo $element["#title"];?>:</strong>
 </div>
-<?php endif; ?> 
+<?php endif; ?>
 <div id="<?php echo $element["#id"]; ?>" class="slider-widget-container">
   <div style="float:left">
     <div id='<?php echo $element["#id"]; ?>_slider' class='ui-slider-1'></div>
   </div>
-  <span style="margin-left: 15px;"><?php if (isset($element["#slider_suffix"])) { echo $element["#slider_suffix"]; } ?><span id='<?php echo $element["#id"]; ?>_nr_0'><?php echo $element["#default"] . $element["#value_suffix"]; ?></span></span>
+  <span style="margin-left: 15px;"><?php if (isset($element["#slider_suffix"])) {
+    echo $element["#slider_suffix"];
+  } ?><span
+    id='<?php echo $element["#id"]; ?>_nr_0'><?php echo $element["#default"] . $element["#value_suffix"]; ?></span></span>
 </div>
 <div style="clear:both;"></div>
 <script type="text/javascript">
-<!--
-jQuery('#<?php echo $element["#id"];?>_slider').slider({
-    slide: Sliders.changeHandle,
+  <!--
+  jQuery('#<?php echo $element["#id"];?>_slider').slider({
+    slide:Sliders.changeHandle,
     step: <?php echo $element["#step"]; ?>,
     value: <?php echo $element["#default"]; ?>,
     max: <?php echo $element["#max"]; ?>,
     min: <?php echo $element["#min"]; ?>
   });
-//-->
+  //-->
 </script>
-<?php if (isset($element["#description"])) : ?> 
+<?php if (isset($element["#description"])) : ?>
 <div class="description" style="margin-bottom:10px;"><?php echo $element["#description"];?></div>
-<?php endif; ?> 
-<input type="hidden" name='<?php echo $element["#name"]; ?>' id='<?php echo $element["#id"];?>_value_0' value='<?php echo $element["#default"]; ?>' />
\ No newline at end of file
+<?php endif; ?>
+<input type="hidden" name='<?php echo $element["#name"]; ?>' id='<?php echo $element["#id"];?>_value_0'
+       value='<?php echo $element["#default"]; ?>'/>
\ No newline at end of file
