diff --git a/notifications_team.module b/notifications_team.module
index 5ec698d..189954e 100644
--- a/notifications_team.module
+++ b/notifications_team.module
@@ -59,10 +59,16 @@ function notifications_team_theme() {
 /**
  * Get list of users from predefined view
  */
-function notifications_team_get_users(&$args = array(), $limit = 0, $simple = FALSE) {
+function notifications_team_get_users(&$args = array(), $limit = 0, $simple = FALSE, $node_type) {
   $result = array();
-
-  $view_name = variable_get('notifications_team_user_view', 'notifications_team_users');
+  
+  if (variable_get('notifications_team_per_type', 0)) {
+    $view_name = variable_get('notifications_team_user_view_' . $node_type, variable_get('notifications_team_user_view', 'notifications_team_users'));
+  }
+  else {
+    $view_name = variable_get('notifications_team_user_view', 'notifications_team_users');
+  }
+  
   if ($view = views_get_view($view_name)) {
     $view->set_display('default');
     $view->preview = TRUE;
@@ -70,7 +76,6 @@ function notifications_team_get_users(&$args = array(), $limit = 0, $simple = FA
     $view->set_items_per_page($limit);
     // Preview the view.
     $output = $view->display_handler->preview();
-
     $view->post_execute();
     if ($simple) {
       foreach ($view->result as $res) {
@@ -91,11 +96,11 @@ function notifications_team_get_users(&$args = array(), $limit = 0, $simple = FA
  * Define a "delicious" like form subscribing users to nodes.
  * TODO - prepopulate with current user|case owner|case assignee
  */
-function notifications_team_form($nid) {
+function notifications_team_form($nid, $node_type) {
   $form = array();
   $args = array();
   // No need to get more than enough users to determine if we have too many and should use autocomplete.
-  $users = notifications_team_get_users($args, variable_get('notifications_team_max_options', 20) + 1);
+  $users = notifications_team_get_users($args, variable_get('notifications_team_max_options', 20) + 1, FALSE, $node_type);
   array_shift($args);
   $args = implode("/", $args);
   $subscribers = array();
@@ -112,7 +117,7 @@ function notifications_team_form($nid) {
     // @TODO how should this be dealt with? some sort of autocomplete unsubscribe function?
     if ($acomplete) {
       $args2 = array("*", implode(",", $subscribers));
-      $users = notifications_team_get_users($args2, 0);
+      $users = notifications_team_get_users($args2, 0, FALSE, $node_type);
     }
 
     // Build the form.
@@ -137,7 +142,7 @@ function notifications_team_form($nid) {
     if ($acomplete) {
       $form['notifications_team']['listed'] = array(
         '#type' => 'textfield',
-        '#autocomplete_path' => 'notifications_team/autocomplete/' . $args,
+        '#autocomplete_path' => 'notifications_team/autocomplete/' . $node_type . '/' . $args,
         '#default_value' => '',
         '#description' => t('Enter list of usernames separated by commas'),
         '#required' => FALSE,
@@ -245,7 +250,7 @@ function _notifications_team_comment($comment) {
     if (isset($comment->notifications_team['listed'])) {
       $textunames = explode(',', $comment->notifications_team['listed']);
       foreach ($textunames as $uname) {
-        $uid = db_query("SELECT uid FROM {users} WHERE name = '%s'", trim($uname));
+        $uid = db_query("SELECT uid FROM {users} WHERE name = :uname", array(':uname' => trim($uname)));
         if ($uid !== FALSE && $uid !== NULL) {
           $uids[] = $uid;
         }
@@ -283,7 +288,7 @@ function _notifications_team_node(&$node) {
     if (isset($node->notifications_team['listed'])) {
       $textunames = explode(',', $node->notifications_team['listed']);
       foreach ($textunames as $uname) {
-        $u = db_fetch_object(db_query("SELECT uid FROM {users} WHERE name = '%s'", trim($uname)));
+        $u = db_fetch_object(db_query("SELECT uid FROM {users} WHERE name = :uname", array(':uname' => trim($uname))));
         if ($u) {
           $new_uids[] = $u->uid;
         }
@@ -305,7 +310,7 @@ function notifications_team_update($nid, $new_uids, $displaymsg = FALSE, $reset
   global $user;
   // Get and wipe existing subs for this thread
   $subscriptions = notifications_team_get_subscriptions($nid, $reset);
-  $allowed = notifications_team_get_users();
+  
   // Create subscriptions
   $doneuids = array();
   $count = 0;
@@ -316,6 +321,8 @@ function notifications_team_update($nid, $new_uids, $displaymsg = FALSE, $reset
     'fields' => array('node:nid' => $nid),
   );
   $node = node_load($nid);
+  $args = array();
+  $allowed = notifications_team_get_users($args, 0, FALSE, $node->type);
   foreach ($new_uids as $uid) {
     if (is_numeric($uid)) {
       if (in_array($uid, $doneuids)) {
@@ -359,35 +366,66 @@ function notifications_team_update($nid, $new_uids, $displaymsg = FALSE, $reset
 }
 
 /**
- * Implements hook_form_alter().
+ * Implements hook_form_BASE_FORM_ID_alter().
  *
  * Adds the notifications_team_form and it's submission handler.
  *
  * For comments, we do it only when comment events are enabled. For insert/edit we don't check event enabled
  * as when creating / editing the node we may want to change which users get notifications for comments
  */
-function notifications_team_form_alter(&$form, &$form_state, $form_id) {
-  global $user;
-
-  if ($form_id == 'node_type_form') {
-    if (isset($form['identity']['type'])) {
-      module_load_include('admin.inc', 'notifications_ui');
-      // Just in case we want to add more settings here
-      $form['notifications']['notifications_team_type'] = array(
-        '#type' => 'checkboxes',
-        '#title' => t('Team UI'),
-        '#default_value' => notifications_team_node_options($form['#node_type']->type),
-        '#options' => array(
-          'node' => t('<strong>In node form</strong>. A Team UI subform will be available when creating or editing nodes.'),
-          'comment' => t('<strong>In comment form</strong>. A Team UI subform will be available when posting comments.'),
-        ),
-        '#description' => t('Enable different display options for Team UI subscription forms.'),
-      );
-      if (!variable_get('notifications_team_per_type', 0)) {
-        $form['notifications']['notifications_team_type']['#disabled'] = TRUE;
-        $form['notifications']['notifications_team_type']['#description'] .= ' <strong>' . t('To enable these options check the <a href="@notifications-team-settings">Notifications Team settings</a>', array('@notifications-team-settings' => url('admin/messaging/notifications/team_ui'))) . '</strong>';
+function notifications_team_form_node_type_form_alter(&$form, &$form_state, $form_id) {
+  module_load_include('admin.inc', 'notifications_ui');
+  // Just in case we want to add more settings here
+  if (isset($form['type'])) {
+    $form['team_notifications'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Team Notifications settings'),
+      '#description' => t('The corresponding Notification subscription type will have to be allowed in this content type for these settings to have any effect.'),
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#group' => 'additional_settings',
+      '#weight' => 99,
+      '#attributes' => array(
+        'class' => array('team-notifications-node-type-settings-form'),
+      ),
+    );
+    $form['team_notifications']['notifications_team_type'] = array(
+      '#type' => 'checkboxes',
+      '#title' => t('Team UI'),
+      '#default_value' => notifications_team_node_options($form['#node_type']->type),
+      '#options' => array(
+        'node' => t('<strong>In node form</strong>. A Team UI subform will be available when creating or editing nodes.'),
+        'comment' => t('<strong>In comment form</strong>. A Team UI subform will be available when posting comments.'),
+      ),
+      '#description' => t('Enable different display options for Team UI subscription forms.'),
+    );
+    
+    $views = array();
+    $all_views = views_get_all_views();
+    foreach ($all_views as $view) {
+      // Only 'users' views that have fields will work for our purpose.
+      if ($view->base_table == 'users' && !empty($view->display['default']->display_options['fields'])) {
+        if ($view->type == 'Default') {
+          $views[t('Default Views')][$view->name] = $view->name;
+        }
+        else {
+          $views[t('Existing Views')][$view->name] = $view->name;
+        }
       }
     }
+    $form['team_notifications']['notifications_team_user_view'] = array(
+      '#title' => t('View for user selection'),
+      '#type' => 'select',
+      '#options' => $views,
+      '#default_value' => variable_get('notifications_team_user_view_' . $form['#node_type']->type, variable_get('notifications_team_user_view', '')),
+      '#description' => t('Choose the view for the list of available users. This view must have at least <i>user id</i> and <i>name</i> fields, with uid being the first field and the name to display being the last. The first argument should be for the autocomplete string, the second for a list of user ids to show (for subscribed ids). The wildcard for the autocomplete argument must be *. Any other arguments will be set and passed onto the autocomplete callback to ensure consistency, so do not use filters for this purpose. Look at !view as an example or starting point.', array('!view' => 'notifications_team_users')),
+    );
+    
+    if (!variable_get('notifications_team_per_type', 0)) {
+      $form['team_notifications']['notifications_team_type']['#disabled'] = TRUE;
+      $form['team_notifications']['notifications_team_user_view']['#disabled'] = TRUE;
+      $form['team_notifications']['notifications_team_type']['#description'] .= ' <strong>' . t('To enable these options check the <a href="@notifications-team-settings">Notifications Team settings</a>', array('@notifications-team-settings' => url('admin/messaging/notifications/team_ui'))) . '</strong>';
+    }
   }
 }
 
@@ -458,7 +496,7 @@ function notifications_team_ui_settings_form() {
     '#default_value' => variable_get('notifications_team_per_type', 0),
     '#options' => array(
       t('Use global settings on this page for all enabled content types.'),
-      t('Set up for each content type on <a href="@content-type-settings">Administer Content Types</a>.', array('@content-type-settings' => url('admin/content/types'))),
+      t('Set up for each content type on <a href="@content-type-settings">Administer Content Types</a>.', array('@content-type-settings' => url('admin/structure/types'))),
     ),
   );
 
@@ -491,7 +529,7 @@ function notifications_team_ui_settings_form() {
 function _notifications_team_addform(&$form, $node_type, $location = 'node', $nid = NULL) {
   // Check to see it thread subscriptions are active for this content type.
   if (notifications_content_type_enabled($node_type, 'content_thread') && notifications_team_node_options($node_type, $location)) {
-    $subscriptions_form = notifications_team_form($nid);
+    $subscriptions_form = notifications_team_form($nid, $node_type);
     if (count($subscriptions_form)) {
       if (isset($form['notifications'])) {
         $form['notifications'] = array_merge($form['notifications'], $subscriptions_form);
@@ -525,10 +563,11 @@ function notifications_team_node_options($type = NULL, $option = NULL) {
 }
 
 /**
- * Helper function for autocompletion. Ony for user names
+ * Helper function for autocompletion. Only for user names
  */
 function notifications_team_autocomplete() {
   $args = func_get_args();
+  $node_type = array_shift($args);
   array_unshift($args, array_pop($args));
   $array = explode(',', $args[0]);
 
@@ -540,10 +579,11 @@ function notifications_team_autocomplete() {
   $matches = array();
   if ($args[0]) {
     $prefix = count($array) ? implode(', ', $array) . ', ' : '';
-    foreach (notifications_team_get_users($args, 10, TRUE) as $user) {
+    foreach (notifications_team_get_users($args, 10, TRUE, $node_type) as $user) {
       $matches[$prefix . $user] = $prefix . $user;
     }
   }
+  
   drupal_json_output($matches);
 }
 
@@ -554,4 +594,4 @@ function notifications_team_views_api() {
   return array(
     'api' => 3,
   );
-}
\ No newline at end of file
+}
