diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..6231ad6
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,13 @@
+Thanks for your interest in d3
+
+There are several javascript charts & graphs libraries out there, googleapi
+and jqplot for example. The D3 library, however, is not only a much more
+flexible library, but also offers more than just charts and graphs.
+
+D3 stands for Data-Driven Documents
+
+INSTALLATION
+
+After downloaded this module you need the D3 javascript library
+
+Download d3.v2.min.js from http://d3js.org : http://d3js.org/d3.v2.min.js
\ No newline at end of file
diff --git a/d3.info b/d3.info
index 4d38410..3aa5c28 100644
--- a/d3.info
+++ b/d3.info
@@ -2,3 +2,8 @@ name = d3.js Example
 description = d3 Javascript library example for testing
 core = 7.x
 dependencies[] = libraries
+
+files[] = inc/BarGraph.class.php
+files[] = inc/ForceDirectedGraph.class.php
+files[] = inc/LineGraph.class.php
+files[] = inc/Visualization.class.php
diff --git a/d3.install b/d3.install
new file mode 100644
index 0000000..65226ee
--- /dev/null
+++ b/d3.install
@@ -0,0 +1,23 @@
+<?php
+
+function d3_requirements($phase) {
+  $requirements = array();
+  // Ensure translations don't break at install time
+  $t = get_t();
+  // Report Drupal version
+  if ($phase == 'runtime') {
+    $requirements['d3'] = array(
+      'title' => $t('d3 javascript library'),
+      'value' => 'Found',
+      'severity' => REQUIREMENT_OK,
+    );
+
+    $lib_path = libraries_get_path('d3');
+    if (!file_exists($lib_path . '/d3.v2.min.js') && !file_exists($lib_path . '/d3.v3.js')) {
+      $requirements['d3']['value'] = 'Missing. Please follow the instructions from README.txt';
+      $requirements['d3']['severity'] = REQUIREMENT_ERROR;
+    }
+  }
+  return $requirements;
+}
+
diff --git a/d3.module b/d3.module
index 9bae58a..37d6a47 100644
--- a/d3.module
+++ b/d3.module
@@ -1,23 +1,16 @@
 <?php
+
 function d3_load() {
 
-  if ($path = libraries_get_path('d3')) {
+  $path = libraries_get_path('d3');
+  if ($path) {
     // Do something with the library, knowing the path, for instance:
-    drupal_add_js($path . '/d3.v2.js', array('group' => JS_LIBRARY, 'weight' => 24));
-    drupal_add_js(drupal_get_path('module', 'd3') .'/js/d3.extend.js', array('group' => JS_LIBRARY, 'weight' => 25));
+    drupal_add_js($path . '/d3.v2.min.js', array('group' => JS_LIBRARY, 'weight' => 24));
+    drupal_add_js(drupal_get_path('module', 'd3') . '/js/d3.extend.js', array('group' => JS_LIBRARY, 'weight' => 25));
 //    drupal_add_js('http://mbostock.github.com/d3/d3.geom.js', 'external');
 //    drupal_add_js('http://mbostock.github.com/d3/d3.layout.js', 'external');
-    drupal_add_css(drupal_get_path('module', 'd3').'/d3.css');
-    module_load_include('php', 'd3', '/inc/Visualization.class');
-    module_load_include('php', 'd3', '/inc/LineGraph.class');
-    module_load_include('php', 'd3', '/inc/BarGraph.class');
-    module_load_include('php', 'd3', '/inc/ForceDirectedGraph.class');
-    
-  } 
-  else { 
-    return drupal_set_message('The d3 library is needed to use this module', 'error');
+    drupal_add_css(drupal_get_path('module', 'd3') . '/d3.css');
   }
-
 }
 
 function d3_draw($chart) {
@@ -33,37 +26,108 @@ function d3_draw($chart) {
     drupal_set_message(t('Invalid chart type !type', array('!type' => $type)));
     return '';
   }
-
 }
 
 function d3_graphapi_formats() {
   return array(
-    'd3' => t('D3'),
+    'd3_bar' => t('D3 Bar Graph'),
+    'd3_force_directed' => t('D3 Force Directed Graph'),
+    'd3_line' => t('D3 Line Graph'),
   );
 }
 
-function d3_graphapi_settings_form($values) {
- 
-  $engine = 'd3'; 
+// TODO: these should be split off into their own modules
+function d3_bar_graphapi_settings_form($values, $is_system = FALSE) {
+  return d3_graphapi_settings_form($values, $is_system, 'd3_bar');
+}
+
+function d3_force_directed_graphapi_settings_form($values, $is_system = FALSE) {
+  return d3_graphapi_settings_form($values, $is_system, 'd3_force_directed');
+}
+
+function d3_line_graphapi_settings_form($values, $is_system = FALSE) {
+  return d3_graphapi_settings_form($values, $is_system, 'd3_line');
+}
+
+// TODO: remove engine when having modules for each engine
+function d3_graphapi_settings_form($values, $is_system = FALSE, $engine) {
+  //$values = _thejit_spacetree_deflate($values);
+  if ($is_system) {
+    // This is the system settings prefix
+    $prefix = $engine . '_default_';
+  }
+  else {
+    $prefix = '';
+  }
+  //$values += thejit_spacetree_default_settings($is_system);
   $form[$engine] = array(
+    '#title' => t('Engine: ' . $engine),
     '#type' => 'fieldset',
-    '#title' => 'D3 settings',
+    '#collapsed' => FALSE,
   );
+  if (!$is_system) {
+    $form[$engine]['#description'] = 'You can change the ' . l('global settings', 'admin/config/system/d3/' . $engine);
+  }
+  else {
+    $form[$engine] = array(
+      '#type' => 'fieldset',
+      '#title' => 'D3 settings' . $engine,
+    );
 
-  return $form;
-  
+    return $form;
+  }
 }
 
 function d3_theme() {
-  return array(
-    'd3_graphapi' => array(
+  $engines = d3_graphapi_formats();
+  $theme_functions = array();
+  foreach ($engines as $engine => $dummy) {
+    $theme_functions[$engine . '_graphapi'] = array(
       'variables' => array(
         'graph' => NULL,
         'config' => NULL,
       ),
-    ),
+    );
+  }
+  return $theme_functions;
+}
+
+function theme_d3_bar_graphapi($vars) {
+  return d3_graphapi($vars);
+}
+
+function theme_d3_force_directed_graphapi($vars) {
+  return d3_graphapi($vars);
+}
+
+function theme_d3_line_graphapi($vars) {
+  return d3_graphapi($vars);
+}
+
+function d3_graphapi($vars) {
+  $graph = _d3_graphapi_format_graph_data($vars['graph']);
+  $chart = array(
+    'type' => 'ForceDirectedGraph',
+    'links' => $graph['links'],
+    'nodes' => $graph['nodes'],
+    'config' => $vars['config'],
   );
-} 
+  return "DRAWING" . d3_draw($chart);
+}
+
+/**
+ * Implements hook_graphapi_default_settings().
+ *
+ * We reuse the default settings from thejit_forcedirected_default_settings.
+ *
+ * @see thejit_forcedirected_default_settings()
+ * @see views_object::option_definition()
+ */
+function d3_graphapi_default_settings() {
+  $engine = 'd3';
+  $values = array();
+  return graphapi_settings_to_views($engine, $values);
+}
 
 function _d3_graphapi_format_graph_data($graph) {
   $data = array();
@@ -83,8 +147,8 @@ function _d3_graphapi_format_graph_data($graph) {
       'group' => isset($node['data']['group']) ? $node['data']['group'] : 1,
       'data' => $node['data'],
     );
-    if(count($node['edges']) > 0) {
-      foreach($node['edges'] as $edge=>$edge_data) {
+    if (count($node['edges']) > 0) {
+      foreach ($node['edges'] as $edge => $edge_data) {
         $value = (int) $edge_data['data']['value'];
 
         $data['links'][] = array(
@@ -100,31 +164,3 @@ function _d3_graphapi_format_graph_data($graph) {
   return $data;
 }
 
-function theme_d3_graphapi($vars) {
-  $graph = _d3_graphapi_format_graph_data($vars['graph']);
-  $chart = array(
-    'type' => 'ForceDirectedGraph',
-    'links' => $graph['links'],
-    'nodes' => $graph['nodes'],
-    'config' => $vars['config'],
-  );
-  return d3_draw($chart);
-}
-
-/**
- * Implements hook_graphapi_default_settings().
- *
- * We reuse the default settings from thejit_forcedirected_default_settings.
- *
- * @see thejit_forcedirected_default_settings()
- * @see views_object::option_definition()
- */
-function d3_graphapi_default_settings() {
-  $engine = 'd3';
-  $values = array();
-  return graphapi_settings_to_views($engine, $values);
-}
-
-function template_preprocess_views_graphapi_style_d3(&$vars) {
-  dsm($vars);
-}
diff --git a/inc/Visualization.class.php b/inc/Visualization.class.php
index 0960bfd..3b03e6d 100644
--- a/inc/Visualization.class.php
+++ b/inc/Visualization.class.php
@@ -2,46 +2,52 @@
 
 class Visualization {
 
-  public $templateFile = NULL;
-  public $templateArgs = array();
+  public $type = 'line';
   public $container_id = 'visualization';
-  public $type;
   public $legend = array();
   public $rows = array();
-
   private $js = '';
 
-  function __construct() {
-  }
-
-  public function container() {
-    return '<div id="'.$this->container_id.'"></div>';
+  function __construct($data) {
+    $this->legend = $data['legend'];
+    $this->rows = $data['rows'];
   }
 
-  public function loadTemplate() {
-    $this->templateArgs['container_id'] = $this->container_id;
-    $this->js_build(theme_render_template($this->templateFile, $this->templateArgs));
+  function container() {
+    return '<div id="' . $this->container_id . '"></div>';
   }
 
-  public function script($js) {
-    return '<script type="text/javascript">'.$js.'</script>';
+  function script($js) {
+    return '<script type="text/javascript">' . $js . '</script>';
   }
 
-  public function js_add_variable($name,$value) {
+  function js_add_variable($name, $value) {
     $value = drupal_json_encode($value);
     $this->js_build("var $name = $value;");
   }
-  public function js_build($js) {
+
+  function js_build($js) {
     $this->js .= "$js\r\n\t";
   }
 
+  function js_load_template($path) {
+  }
+
+  function js_process_template($variables = array()) {
+    $path = drupal_get_path('module', 'd3');
+    $template_file = theme_render_template($path . '/templates/line.tpl.js', $variables);
+    return $template_file;
+  }
+
   public function render() {
 
-    if($this->templateFile)
-      $this->js_build($this->loadTemplate());
+    $output = $this->container();
+
+    $this->js_add_variable('key', $this->legend);
+    $this->js_add_variable('rows', $this->rows);
 
-    // render the container that was set and ALL of the javascript that has been accumulated	
-    return $this->container() . $this->script($this->js);
+    $this->js_build($this->js_process_template());
+    return $output . $this->script($this->js);
   }
-}
 
+}
diff --git a/inc/visualization.class.php b/inc/visualization.class.php
deleted file mode 100644
index 92be10d..0000000
--- a/inc/visualization.class.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-class Visualization {
-
-	public $type = 'line';
-	public $container_id = 'visualization';
-	public $legend = array();
-	public $rows = array();
-
-	private $js = '';
-
-	function __construct($data) {
-		$this->legend = $data['legend'];	
-		$this->rows = $data['rows'];	
-	}
-
-	private function container() {
-		return '<div id="'.$this->container_id.'"></div>';
-	}
-
-	private function script($js) {
-		return '<script type="text/javascript">'.$js.'</script>';
-	}
-
-	private function js_add_variable($name,$value) {
-		$value = drupal_json_encode($value);
-		$this->js_build("var $name = $value;");
-	}
-	private function js_build($js) {
-		$this->js .= "$js\r\n\t";
-	}
-	private function js_load_template($path) {
-		
-	}
-	private function js_process_template($variables = array()) {
-		$template_file = theme_render_template('/sites/all/modules/custom/d3/templates/line.tpl.js', $variables);
-		return $template_file;
-	}
-	public function render() {
-
-		$output = $this->container();
-		
-		$this->js_add_variable('key', $this->legend);	
-		$this->js_add_variable('rows', $this->rows);
-
-		$this->js_build($this->js_process_template());
-		return $output . $this->script($this->js);
-	}
-}
