diff --git a/modules/iaas/modules/aws_cloud/includes/aws_cloud_security_groups_ui.inc b/modules/iaas/modules/aws_cloud/includes/aws_cloud_security_groups_ui.inc
index 707f8ef..73b67ff 100644
--- a/modules/iaas/modules/aws_cloud/includes/aws_cloud_security_groups_ui.inc
+++ b/modules/iaas/modules/aws_cloud/includes/aws_cloud_security_groups_ui.inc
@@ -364,6 +364,70 @@ function aws_cloud_display_security_group($form_submit = '', $form_state, $cloud
   $grp['grp_owner']['#default_value'] = ($owner_id)
                                       ?  $owner_id
                                       : '';
+
+  $grp_protocol = !empty($form_state['values']['grp_protocol']) ? $form_state['values']['grp_protocol'] : 'tcp';
+  // add in select for better user experience
+  $grp['grp_protocol'] = array(
+    '#type' => 'select',
+    '#options' => array('tcp' => t('TCP'), 'udp' => t('UDP'), 'icmp' => t('ICMP')),
+    '#disabled' => $txt_disabled,
+    '#default_value' => $grp_protocol,
+    '#ajax' => array(
+      'callback' => 'aws_cloud_group_select_callback',
+      'wrapper' => 'group-configuration',
+      'method' => 'replace',
+      'effect' => 'fade',
+    ),
+  );
+  
+  $grp['grp_wrapper'] = array(
+    '#prefix' => '<div id="group-configuration">',
+    '#suffix' => '</div>',
+  );
+  if ($grp_protocol == 'icmp') {
+    $grp['grp_wrapper']['config']['grp_icmp_IPs'] = array(
+      '#type' => 'textfield',
+      '#size' => '14',
+      '#title' => t('IPs'),
+      '#default_value' => !empty($form_state['values']['grp_icmp_IPs']) ? $form_state['values']['grp_icmp_IPs'] : '0.0.0.0/32',
+    );
+    $grp['grp_wrapper']['config']['grp_icmp_Ports_start'] = array(
+      '#type' => 'textfield',
+      '#size' => '4',
+      '#title' => t('Type'),
+      '#default_value' => !empty($form_state['values']['grp_icmp_Ports_start']) ? $form_state['values']['grp_icmp_Ports_start'] : '-1',
+    );
+    $grp['grp_wrapper']['config']['grp_icmp_Ports_end'] = array(
+      '#type' => 'textfield',
+      '#size' => '4',
+      '#title' => t('Code'),
+      '#default_value' => !empty($form_state['values']['grp_icmp_Ports_end']) ? $form_state['values']['grp_icmp_Ports_end'] : '-1',
+    );
+  }
+  else {
+    $grp['grp_wrapper']['config']['grp_ips'] = array(
+      '#type' => 'textfield',
+      '#size' => '14',
+      '#title' => t('IPs'),
+      '#default_value' => !empty($form_state['values']['grp_ips']) ? $form_state['values']['grp_ips'] : '0.0.0.0/32',
+      '#disabled' => $txt_disabled,
+    );
+    $grp['grp_wrapper']['config']['grp_tcp_Ports_start'] = array(
+      '#type' => 'textfield',
+      '#size' => '4',
+      '#title' => t('Ports'),
+      '#default_value' => !empty($form_state['values']['grp_tcp_Ports_start']) ? $form_state['values']['grp_tcp_Ports_start'] : '0',
+      '#disabled' => $txt_disabled,
+    );
+    $grp['grp_wrapper']['config']['grp_tcp_Ports_end'  ] = array(
+      '#type' => 'textfield',
+      '#size' => '4',
+      '#field_prefix' => ' .. '    ,
+      '#default_value' => !empty($form_state['values']['grp_tcp_Ports_end']) ? $form_state['values']['grp_tcp_Ports_end'] : '0',
+      '#disabled' => $txt_disabled,
+    );
+  }
+
   $form['SG_details']['AddIPs_Grp_Content']   = $grp  ;
 
   if (user_access($cloud_context . ' setup security group') ) {
@@ -407,6 +471,7 @@ function aws_cloud_display_security_group($form_submit = '', $form_state, $cloud
 }
 
 
+
 /**
  * Theme security group form
  * @param     $form
@@ -511,6 +576,59 @@ function theme_aws_cloud_display_security_group($form) {
 }
 
 /**
+ * Ajax callback to set the appropriate fields for the "Add Group"
+ */
+function aws_cloud_group_select_callback($form, $form_state) {
+  return $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper'];
+//   switch ($form_state['values']['grp_protocol']) {
+//     case 'tcp':
+//     case 'udp':
+//       unset($form['SG_details']['AddIPs_Grp_Content']['grp_wrapper']['config']);
+//       $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper']['config']['grp_ips'] = array(
+//         '#type' => 'textfield',
+//         '#size' => '14',
+//         '#title' => t('IPs'),
+//         //'#default_value' => !empty($form_state['values']['grp_ips']) ? $form_state['values']['grp_ips'] : '0.0.0.0/32',
+//       );
+//       $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper']['config']['grp_tcp_Ports_start'] = array(
+//         '#type' => 'textfield',
+//         '#size' => '4',
+//         '#title' => t('Ports'),
+//         '#default_value' => !empty($form_state['values']['grp_tcp_Ports_start']) ? $form_state['values']['grp_tcp_Ports_start'] : '0',
+//       );
+//       $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper']['config']['grp_tcp_Ports_end'] = array(
+//         '#type' => 'textfield',
+//         '#size' => '4',
+//         '#field_prefix' => ' .. ',
+//         '#default_value' => !empty($form_state['values']['grp_tcp_Ports_end']) ? $form_state['values']['grp_tcp_Ports_end'] : '0',
+//       );
+//       return $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper'];
+//     case 'icmp':
+//       unset($form['SG_details']['AddIPs_Grp_Content']['grp_wrapper']['config']);
+//       $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper']['config']['grp_icmp_IPs'] = array(
+//         '#type' => 'textfield',
+//         '#size' => '14',
+//         '#title' => t('IPs'),
+//         '#default_value' => !empty($form_state['values']['grp_icmp_IPs']) ? $form_state['values']['grp_icmp_IPs'] : '0.0.0.0/32',
+//       );
+//       $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper']['config']['grp_icmp_Ports_start'] = array(
+//         '#type' => 'textfield',
+//         '#size' => '4',
+//         '#title' => t('Type'),
+//         '#default_value' => !empty($form_state['values']['grp_icmp_Ports_start']) ? $form_state['values']['grp_icmp_Ports_start'] : '-1',
+//       );
+//       $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper']['config']['grp_icmp_Ports_end'] = array(
+//         '#type' => 'textfield',
+//         '#size' => '4',
+//         '#title' => t('Code'),
+//         '#default_value' => !empty($form_state['values']['grp_icmp_Ports_end']) ? $form_state['values']['grp_icmp_Ports_end'] : '-1',
+//       );
+//       return $form['SG_details']['AddIPs_Grp_Content']['grp_wrapper'];
+//   }
+
+}
+
+/**
  * Submit function to update security groups
  * @param     $form_id
  * @param     $form_values
@@ -523,7 +641,7 @@ function aws_cloud_display_security_group_submit($form_id, &$form_state) {
   $cloud_menu_path = cloud_get_menu_path($cloud_context);
   $result = TRUE;
   
-  if ($form_values['operation_type'] == 'AddIPs_TCP_Button') {
+  if ($form_state['triggering_element']['#name'] == 'AddIPs_TCP_Button') {
     // User Activity Log
     cloud_audit_user_activity( 
       array(
@@ -533,8 +651,9 @@ function aws_cloud_display_security_group_submit($form_id, &$form_state) {
       )
     );
     $result = aws_cloud_authorize_security_group($cloud_context, $form_values['group_name'], '', '', $form_values['protocol'], $form_values['tcp_Ports_start'], $form_values['tcp_Ports_end'], $form_values['tcp_IPs']);
+
   }
-  elseif ($form_values['operation_type'] == 'AddIPs_ICMP_Button') {
+  elseif ($form_state['triggering_element']['#name'] == 'AddIPs_ICMP_Button') {
     // User Activity Log
     cloud_audit_user_activity( 
       array(
@@ -546,8 +665,14 @@ function aws_cloud_display_security_group_submit($form_id, &$form_state) {
 
     $result = aws_cloud_authorize_security_group($cloud_context, $form_values['group_name'], '', '', 'icmp', $form_values['icmp_Ports_start'], $form_values['icmp_Ports_end'], $form_values['icmp_IPs']);
   }
-  elseif ($form_values['operation_type'] == 'Add_Grp_Button') {
-    $result = aws_cloud_authorize_security_group($cloud_context, $form_values['group_name'], $form_values['grp'], $form_values['grp_owner']);
+  elseif ($form_state['triggering_element']['#name'] == 'Add_Grp_Button') {
+    // Takes the values (IP & Port Range) from the AddIPs_TCP
+    if ($form_values['grp_protocol'] == 'icmp') {
+      $result = aws_cloud_authorize_security_group($cloud_context, $form_values['group_name'], $form_values['grp'], $form_values['grp_owner'], 'icmp', $form_values['grp_icmp_Ports_start'], $form_values['grp_icmp_Ports_end'], $form_values['grp_icmp_IPs']);
+    }
+    else {
+      $result = aws_cloud_authorize_security_group($cloud_context, $form_values['group_name'], $form_values['grp'], $form_values['grp_owner'], $form_values['grp_protocol'], $form_values['grp_tcp_Ports_start'], $form_values['grp_tcp_Ports_end'], $form_values['grp_ips']);
+    }
   }
   elseif ($form_values['op'] == t('List Security Groups')) {
     $form_state['redirect'] = $cloud_menu_path . '/security_groups';
@@ -961,8 +1086,9 @@ function theme_aws_cloud_display_security_group_list($form) {
 function aws_cloud_get_security_action($cloud_context, $security_info) {
   $cloud_menu_path = cloud_get_menu_path($cloud_context);
   $action_data = array();
-  $prop['onclick'] = cloud_get_messagebox('Are you sure you want to delete the Security Group "' . $security_info['group_name'] . '" ?');
+
   if (user_access($cloud_context . ' delete security group') ) {
+    $prop['onclick'] = cloud_get_messagebox('Are you sure you want to delete the Security Group "' . $security_info['group_name'] . '" ?');
     $action_data[] = cloud_display_action('images/icon_delete.png', t('Delete'), $cloud_menu_path . '/security_groups/delete', array('query' => array('sg_name' => $security_info['group_name']), 'html' => TRUE), $prop['onclick']);
   }
   
@@ -973,6 +1099,7 @@ function aws_cloud_get_security_action($cloud_context, $security_info) {
   $user_actions = module_invoke_all('aws_cloud_security_action_data', $security_info);
   $action_data = array_merge($action_data, $user_actions);
   return implode($action_data);
+  
 }
 
 
