diff --git a/isbn.info b/isbn.info
index d24a290..2d5c485 100755
--- a/isbn.info
+++ b/isbn.info
@@ -1,4 +1,4 @@
 name = ISBN
 description = Keeps track of ISBNs
 version = VERSION
-core = 6.x
\ No newline at end of file
+core = 7.x
diff --git a/isbn.install b/isbn.install
index 9f162b7..1ea13b7 100755
--- a/isbn.install
+++ b/isbn.install
@@ -1,42 +1,21 @@
 <?php
 
-function isbn_schema() {
-    $schema['isbn_node'] = array(
-    'description' => t('Table to associate nodes w/normalized ISBNs.'),
-    'fields' => array(
-      'nid'     => array(
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'default' => 0,
-        'description' => t("The isbn's {node}.nid.")
-        ),
+/**
+ * @file
+ * Defines schema for ISBN fields
+ */
+
+/**
+ * Implements hook_field_schema().
+ */
+function isbn_field_schema($field) {
+  return array(
+    'columns' => array(
       'isbn' => array(
-        'description' => t('The ISBN field.'),
         'type' => 'varchar',
-        'length' => 16,
-        'not null' => TRUE,
-        'default' => ''),
-      'isbn10' => array(
-        'description' => t('The old 10 digit ISBN value.'),
-        'type' => 'varchar',
-        'length' => 16,
-        'not null' => TRUE,
-        'default' => ''),
+         'length' => 255,
+         'not null' => FALSE,
       ),
-    'primary key' => array('nid', 'isbn'),
-    );
-    return $schema;
-}        
-
-function isbn_install() {
-  drupal_install_schema('isbn');
+    ),
+  );
 }
-
-/**
- * Implementation of hook_uninstall().
- */
-function isbn_uninstall() {
-  // Remove tables.
-  drupal_uninstall_schema('isbn');
-}
\ No newline at end of file
diff --git a/isbn.module b/isbn.module
index 0724e0c..2970247 100755
--- a/isbn.module
+++ b/isbn.module
@@ -5,9 +5,49 @@
  *  Maintains a consistant relationship between nodes and ISBNs.
  */
 
+/**
+ * Implements hook_field_info().
+ */
+function isbn_field_info() {
+  return array(
+    'isbn' => array(
+      'label' => 'ISBN',
+      'description' => t('This field stores and renders ISBN numbers.'),
+      'default_widget' => 'isbn_textfield',
+      'default_formatter' => 'isbn_default',
+      'property_type' => 'text',
+    ),
+  );
+}
+
+/**
+ * Implements hook_field_validate().
+ *
+ */
+function isbn_field_validate($obj_type, $object, $field, $instance, $langcode, $items, &$errors) {
+  foreach ($items as $delta => $item) {
+
+    $isbn = isbn_clean_data($item['isbn']);
+
+    if ($isbn != '' && !isbn_check_10($isbn) && !isbn_check_13($isbn)) {
+      if (strlen($isbn) == 10 && !isbn_check_10($isbn)) {
+        $message = t('"%isbn" isn\'t a valid 10 digit ISBN number', array('%isbn' => $isbn));
+      }
+
+      if (strlen($isbn) == 13 && !isbn_check_13($isbn)) {
+        $message = t('"%isbn" isn\'t a valid 13 digit ISBN number', array('%isbn' => $isbn));
+      }
+
+      $errors[$field['field_name']][$langcode][$delta][] = array(
+        'error' => "isbn_invalid",
+        'message' => $message,
+      );
+    }
+  }
+}
 
 /**
- * Implementation of hook_menu().
+ * Implements of hook_menu().
  */
 function isbn_menu() {
   $items = array();
@@ -22,197 +62,129 @@ function isbn_menu() {
   return $items;
 }
 
-function isbn_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){
-  switch ($op){
-
-    case 'insert':
-    case 'update':
-      if ($node->isbn['isbn']){
-        $isbn_values = $node->isbn['isbn'];
-      }
-      else {
-        $isbn_values = isbn_find_isbns($node);
-      }
-      db_query("DELETE FROM {isbn_node} WHERE nid = %d", $node->nid);
-      if ($isbn_values){
-        foreach($isbn_values as $isbn_value){
-          if ($isbn_value['isbn'] > 1) {
-            $isbn->isbn = $isbn_value['isbn'];
-            $isbn->isbn10 = $isbn_value['isbn10'];
-            $isbn->nid = $node->nid;
-            drupal_write_record('isbn_node', $isbn);
-          }
-        }
-      }
-      break;
-    
-      case 'load':
-        $result = db_query("SELECT * FROM {isbn_node} WHERE nid = %d", $node->nid);
-        while ($isbn_node = db_fetch_object($result)){
-          if ($isbn_node){
-            $isbn = array('isbn' => $isbn_node->isbn, 'isbn10' => $isbn_node->isbn10,);
-            drupal_alter('isbn', $isbn);
-            $node->isbn[] = $isbn;
-          }
-        }
-        //return $node;
-        break;
-    
-      case 'delete':
-        db_query("DELETE FROM {isbn_node} WHERE nid = %d", $node->nid);
-        break;
-    }
+/**
+ * Implements hook_field_widget_error().
+ */
+function isbn_field_widget_error($element, $error, $form, &$form_state) {
+  form_error($element, $error['message']);
 }
 
-//This might be useful to use with case 'load': 
-function isbn_load_nid($node){
-  $result = db_query("SELECT * FROM {isbn_node} WHERE nid = %d", $node->nid);
-  while ($isbn_node = db_fetch_object($result)){
-    if ($isbn_node){
-      $isbn = array('isbn' => $isbn_node->isbn, 'isbn10' => $isbn_node->isbn10,);
-      drupal_alter('isbn', $isbn);
-      $node->isbn[] = $isbn;
-    }
+/**
+ * Implements hook_content_is_empty().
+ */
+function isbn_field_is_empty($item, $field) {
+  if (empty($item['isbn'])) {
+    return TRUE;
   }
-  return $node;
+  return FALSE;
 }
 
+/**
+ * Implements hook_field_formatter_info().
+ *
+ */
+function isbn_field_formatter_info() {
+  $formats = array(
+    'isbn_default' => array(
+      'label' => t('Not formated ISBN'),
+      'description' => t('Display the ISBN number without format.'),
+      'field types' => array('isbn'),
+    ),
+  );
+  return $formats;
+}
 
-function isbn_find_isbns($node){
-  //This should not be so hardcoded but for now it is.
-  //$isbn_fields = variable_get('isbn_fields', null);
-  $isbn_fields = array('field_isbn',);
-  if ($isbn_fields){
-    $isbns = array();
-    foreach($isbn_fields as $isbn_field){
-      if ($node->$isbn_field){
-        if (is_array($node->$isbn_field)){
-          foreach($node->$isbn_field as $field){
-            $isbns = isbn_build_isbns(isbn_clean_field($field['value']));
-            $isbn13 = $isbns['isbn'];
-            $isbn_list[$isbn13] = $isbns;
-          }
-        }
+/**
+ * Implements hook_field_formatter_view().
+ */
+function isbn_field_formatter_view($object_type, $object, $field, $instance, $langcode, $items, $display) {
+  $element = array();
+  switch ($display['type']) {
+    case 'isbn_default':
+      foreach ($items as $delta => $item) {
+        $element[$delta] = array('#markup' => isbn_clean_data($item['isbn']));
       }
-    }
+      break;
   }
-  return $isbn_list;
+  return $element;
 }
 
-
-function isbn_clean_field($field){
-  $bad_chars = array("-", "/", " ");
-  $isbn = strtoupper(trim(str_replace ($bad_chars, "", $field)));
-  if (strlen($isbn) > 9){
-    $test = substr($isbn, 10, 1);
-    if (is_numeric($test)){
-      $isbn = substr($isbn, 0, 13);
-    }
-    else {
-      $isbn = substr($isbn, 0, 10);
-    }
-  }
-  else {
-    $isbn = null;
-  }
-  return $isbn;
+/**
+ * Implements hook_field_widget_info().
+ */
+function isbn_field_widget_info() {
+  return array(
+    'isbn_textfield' => array(
+      'label' => t('Text field'),
+      'field types' => array('isbn'),
+      'settings' => array('size' => 60),
+    ),
+  );
 }
 
+/**
+ * Implements hook_field_widget_settings_form().
+ */
+function isbn_field_widget_settings_form($field, $instance) {
+  $widget = $instance['widget'];
+  $settings = $widget['settings'];
 
-function isbn_build_isbns($isbn){
-  switch (strlen($isbn)){
-    case 10:
-      if (substr($isbn,9,1) == isbn_check_10($isbn)){
-        $isbns['isbn10'] = $isbn;
-        $check = isbn_check_13('978'.$isbn);
-        $isbns['isbn'] = '978'.substr($isbn,0,9).$check;
-      }
-      else {
-        
-      }
-    break;
+  $form['size'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Size of textfield'),
+    '#default_value' => $settings['size'],
+    '#required' => TRUE,
+    '#element_validate' => array('_element_validate_integer_positive'),
+  );
+  return $form;
+}
 
-    case 13:
-      if (substr($isbn,12,1) == isbn_check_13($isbn)){
-        $isbns['isbn'] = $isbn;
-        $check = isbn_check_10(substr($isbn, 3, 10));
-        $isbns['isbn10'] = substr($isbn, 3, 9).$check;
-      }
-      break;
-  }
-  return $isbns;
+/**
+ * Implements hook_field_widget_form().
+ */
+function isbn_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $base) {
+  $element = $base;
+  $element['isbn'] = $base + array(
+    '#type' => 'textfield',
+    '#default_value' => isset($items[$delta]['isbn']) ? $items[$delta]['isbn'] : NULL,
+    '#size' => $instance['widget']['settings']['size'],
+    '#prefix' => '<div class="text-full-wrapper">',
+    '#suffix' => '</div>',
+  );
+  return $element;
 }
-function isbn_check_10($isbn){
-  for ($i = 0; $i < 9; $i++) {
-    $digit = substr($isbn, $i, 1);
-    $total = $total + ($digit * (10-$i));
-  }
-  $remainder = $total % 11;
-  $check = 11 - $remainder;
-  if ($check == 10){
-    $check = 'X';
-  }
-  elseif($check == 11){
-    $check = 0;
-  }
-  return $check;
+
+function isbn_clean_data($isbn) {
+  return preg_replace('/([^xX0-9]*)/', "", $isbn);
 }
 
-function isbn_check_13($isbn){
-  $weight = 1;
-  for ($i = 0; $i < 12; $i++) {
-    $digit = substr($isbn, $i, 1);
-    $total = $total + ($digit * $weight);
-    //drupal_set_message(' i '.$i.' digit '.$digit.' x '.$weight.'Total '.$total);
-    if ($weight == 1){
-      $weight = 3;
-    }
-    else {
-      $weight = 1;
-    }
-  }
-  $remainder = $total % 10;
-  $check = 10 - $remainder;
-  if ($check == 10){
-    $check = '0';
+function isbn_check_10($isbn) {
+  if (strlen($isbn) < 10) {
+    return False;
   }
-  return $check;
-}
 
-//This is just used to check the ISBN formula.
-function isbn_form(){
-  $form['isbn'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Give up an ISBN'),
-    '#description' => t('Type in an isbn.'),
-    '#required' => TRUE,
-  );
-  $form['submit'] = array(
-    '#value' => 'go',
-    '#type' => 'submit',
-    '#submit' => array('isbn_form_submit'),
-  );
-  return $form;
+  $check = 0;
+  for ($i = 0; $i < 9; $i++) {
+    $check += (10 - $i) * substr($isbn, $i, 1);
+  }
+  $t = substr($isbn, 9, 1); // tenth digit (aka checksum or check digit)
+  $check += ($t == 'x' || $t == 'X') ? 10 : $t;
+  return $check % 11 == 0;
 }
 
-function isbn_form_submit($form, $form_state){
-  $field = $form_state['values']['isbn'];
-  if ($field){
-    $isbn = isbn_clean_field($field);
+function isbn_check_13($isbn) {
+  if (strlen($isbn) < 13) {
+    return False;
   }
-  $isbns = isbn_build_isbns($isbn);
-  drupal_set_message('10 digit ISBN '.$isbns['isbn10']);
-  drupal_set_message('13 digit ISBN '.$isbns['isbn']);
-  if (isbn_check_10($isbns['isbn10'])){
-    drupal_set_message('Valid ISBN 10');
+  $check = 0;
+
+  for ($i = 0; $i < 13; $i+=2) {
+    $check += substr($isbn, $i, 1);
   }
-  if (isbn_check_13($isbns['isbn'])){
-    drupal_set_message('Valid ISBN 13');
+
+  for ($i = 1; $i < 12; $i+=2) {
+    $check += 3 * substr($isbn, $i, 1);
   }
-}
 
-function isbn_isbn_alter($isbn){
-  $items = amazon_item_lookup($isbn['isbn10']);
-  $isbn['amazon'] = array_pop($items);
-  return $isbn;
-}
\ No newline at end of file
+  return ($check % 10) == 0;
+}
