diff --git a/role_expire.install b/role_expire.install
index f1c967f..3ccb3bd 100644
--- a/role_expire.install
+++ b/role_expire.install
@@ -46,10 +46,10 @@ function role_expire_schema() {
         'description' => t('The role_id.')
       ),
       'duration' => array(
-        'type' => 'int',
-        'unsigned' => TRUE,
+        'type' => 'text',
+        'size' => 'small',
         'not null' => TRUE,
-        'description' => t('The default duration for the role.')
+        'description' => t('A strtotime-compatible default duration string'),
       ),
     ),
     'primary key' => array('rid'),
diff --git a/role_expire.module b/role_expire.module
index fb91048..51bf856 100644
--- a/role_expire.module
+++ b/role_expire.module
@@ -113,8 +113,30 @@ function role_expire_write_record($uid, $rid, $expiry_timestamp) {
  *  or empty string if not set.
  */
 function role_expire_get_default_duration($rid) {
-  $result = db_query("SELECT duration FROM {role_expire_length} WHERE rid = :rid", array(':rid' => $rid))->fetchField();
-  return (!empty($result)) ? $result : '';
+  // Because this function is called a couple times during the same page load,
+  // remember the result from the first call.
+  static $default_duration = array();
+  if (!isset($default_duration[$rid])) {
+    $result = db_query("SELECT duration FROM {role_expire_length} WHERE rid = :rid", array(':rid' => $rid))->fetchField();
+    // duration in the old version of role_expire was an int. Now it's a string.
+    // If $result is an int, then they need to run update.php.
+    if (!empty($result)) {
+      // Is result an int?
+      $int_result = (int) $result;
+      if ((string)$int_result == $result) {
+        // That's bad. Need to run update.php.
+        trigger_error(t('role_expire schema is out of date. You must run update.php.'),E_USER_ERROR);
+        return;
+      }
+      // Else we're all good.
+    }
+    else {
+      // Result is 'empty'. Make sure it's the empty string.
+      $result = '';
+    }
+    $default_duration[$rid] = $result;
+  }
+  return $default_duration[$rid];
 }
 
 
@@ -129,12 +151,23 @@ function role_expire_get_default_duration($rid) {
 function role_expire_set_default_duration($rid, $duration) {
 
   if (!empty($duration)) {
-    $result = db_update('role_expire_length')
-              ->fields(array('duration' => check_plain($duration),))
-              ->condition('rid', $rid)
-              ->execute();
 
-    if (!$result) {
+    // Do we have a value already?
+    $prev_duration = role_expire_get_default_duration($rid);
+
+    // If we have a previous duration, attempt to do an UPDATE.
+    if ($prev_duration) {
+
+      // If the new value is the same as the old value, do nothing.
+      if ($duration != $prev_duration) {
+        $result = db_update('role_expire_length')
+                  ->fields(array('duration' => check_plain($duration),))
+                  ->condition('rid', $rid)
+                  ->execute();
+      }
+    }
+    else {
+      // We didn't have a previous value. This is a new value. Do an INSERT.
       $id = db_insert('role_expire_length')
             ->fields(array(
               'rid' => $rid,
@@ -183,11 +216,12 @@ function role_expire_get_expired($time = '') {
  * Implements hook_views_api().
  */
 function role_expire_views_api() {
-  // We can't just return "what is the currently installed views API version!
-  // We have to specify which version of the API we designed this implementation
-  // around.
-  // return array("api" => views_api_version());
-  return array('api' => '3.0');
+
+  // Any Views 3 version is fine.
+  $current_views_version = views_api_version();
+  if (preg_match('/^3\./',$current_views_version)) {
+    return array('api' => $current_views_version);
+  }
 }
 
 /**
@@ -284,21 +318,17 @@ function role_expire_user_admin_role_validate($form, &$form_state) {
  * Updates default duration in database.
  */
 function role_expire_user_admin_role_submit($form, &$form_state) {
-  if ($form_state['values']['op'] == t('Delete role')) {
+
+  // If the role is being deleted, delete the default duration.
+  // OR, if the new default duration is blank (empty), delete the default duration.
+  if ($form_state['values']['op'] == t('Delete role') || empty($form_state['values']['role_expire'])) {
     role_expire_delete_default_duration($form_state['values']['rid']);
   }
   elseif ($form_state['values']['op'] == t('Save role')) {
 
-    // If the form doesn't specify a default duration, then delete default duration.
-    // Otherwise, set the default duration to what's specified.
-    $new_default_duration = $form_state['values']['role_expire'];
-    if (is_numeric($new_default_duration) && $new_default_duration > 0) {
-      role_expire_set_default_duration($form_state['values']['rid'], $form_state['values']['role_expire']);
-      drupal_set_message('New default role expiration set.');
-    }
-    else {
-      role_expire_delete_default_duration($form_state['values']['rid']);
-    }
+    // Set the default duration to what's specified.
+    role_expire_set_default_duration($form_state['values']['rid'], $form_state['values']['role_expire']);
+    drupal_set_message('New default role expiration set.');
   }
 }
 
