--- userpoints_nodelimit.module	2011-04-16 13:51:19.000000000 -0400
+++ userpoints_nodelimit.module.working	2011-04-16 13:50:05.000000000 -0400
@@ -26,24 +26,25 @@ function userpoints_nodelimit_form_alter
   }
   else {
     if (isset($form['#node']) && isset($form['#method']) && $form['#node']->type .'_node_form' == $form_id) {
-    //this is a node form
-    if (userpoints_nodelimit_get_setting($form['#node']->type) == USERPOINTS_NODELIMIT_ENABLED) {
-			// check the number of available user points against the requirements for this node
-      if (!userpoints_nodelimit_check($form['#node']->type)) {
-     		drupal_set_message(userpoints_nodelimit_insufficent_points_message($form['#node']->type), 'error');
-      	//destory the form
-      	$form = NULL;
-      	//return a simple hidden field so that function doesn't fail
-      	$form['dummy'] = array(
-       		'#type' => 'hidden',
-        	'#default_value' => '',
-      	);
+      //this is a node form
+      if (userpoints_nodelimit_get_setting($form['#node']->type) == USERPOINTS_NODELIMIT_ENABLED) {
+        // check the number of available user points against the requirements for this node
+        if (!userpoints_nodelimit_check($form['#node']->type)) {
+           drupal_set_message(userpoints_nodelimit_insufficent_points_message($form['#node']->type), 'error');
+          //destory the form
+          $form = NULL;
+          //return a simple hidden field so that function doesn't fail
+          $form['dummy'] = array(
+             '#type' => 'hidden',
+            '#default_value' => '',
+          );
+        }
+        else {
+           // add a validate function as the points may change between the opening for the form  
+           // and the submission of the form, so we should check again prior to submission
+          $form['#validate'][] = 'userpoints_nodelimit_validate';
+        }
       }
-      else {
-     		// add a validate function as the points may change between the opening for the form  
-     		// and the submission of the form, so we should check again prior to submission
-				$form['#validate'][] = 'userpoints_nodelimit_validate';
-			}
     }
   }
 }
@@ -52,7 +53,6 @@ function userpoints_nodelimit_form_alter
   * Form validation
   */ 
 function userpoints_nodelimit_validate($form, &$form_state) {
-  
   // check the user points and confirm they have enough
   if (!userpoints_nodelimit_check($form['#node']->type))
     form_set_error('userpoints_nodelimit_details', userpoints_nodelimit_insufficent_points_message($form['#node']->type));
@@ -108,22 +108,22 @@ function userpoints_nodelimit_get_settin
 }
 
 /**
- * Implementation of hook_node_type().
+ * Implementation of hook_node_type_delete().
  */
-function userpoints_nodelimit_node_type($op, $info) {
-  switch ($op) {
-    case 'delete':
-      variable_del('userpoints_nodelimit_'. $info->type);
-      variable_del('userpoints_nodelimit_nodepoints_'. $info->type);
-      break;
-    case 'update':
-      if (!empty($info->old_type) && $info->old_type != $info->type) {
-        variable_set('userpoints_nodelimit_'. $info->type, userpoints_nodelimit_get_setting($info->old_type));
-        variable_set('userpoints_nodelimit_nodepoints_'. $info->type, variable_get('userpoints_nodelimit_nodepoints_'. $info->old_type, ''));
-        variable_del('userpoints_nodelimit_'. $info->old_type);
-        variable_del('userpoints_nodelimit_nodepoints_'. $info->old_type);
-      }
-      break;
+function userpoints_nodelimit_node_type_delete($info) {
+  variable_del('userpoints_nodelimit_'. $info->type);
+  variable_del('userpoints_nodelimit_nodepoints_'. $info->type);
+}
+
+/**
+ * Implementation of hook_node_type_update().
+ */
+function userpoints_nodelimit_node_type_update($info) {
+  if (!empty($info->old_type) && $info->old_type != $info->type) {
+    variable_set('userpoints_nodelimit_'. $info->type, userpoints_nodelimit_get_setting($info->old_type));
+    variable_set('userpoints_nodelimit_nodepoints_'. $info->type, variable_get('userpoints_nodelimit_nodepoints_'. $info->old_type, ''));
+    variable_del('userpoints_nodelimit_'. $info->old_type);
+    variable_del('userpoints_nodelimit_nodepoints_'. $info->old_type);
   }
 }
 
@@ -142,4 +142,3 @@ function userpoints_nodelimit_check($nod
     return FALSE;
   }
 }
-
