diff --git a/commerce_discount.module b/commerce_discount.module
index 86f40b1..28a7c03 100644
--- a/commerce_discount.module
+++ b/commerce_discount.module
@@ -62,7 +62,8 @@ function commerce_discount_commerce_cart_order_refresh($wrapper) {
 
           if ($wrapper_line_item->commerce_unit_price->amount->value() != $old_line_item_wrapper->commerce_unit_price->amount->value() ||
             $wrapper_line_item->commerce_unit_price->currency_code->value() != $old_line_item_wrapper->commerce_unit_price->currency_code->value() ||
-            $data['components'] != $old_data['components']) {
+            $data['components'] != $old_data['components']
+          ) {
             // Save changed line item (which will correctly set commerce_total).
             $wrapper_line_item->save();
           }
@@ -79,6 +80,90 @@ function commerce_discount_commerce_cart_order_refresh($wrapper) {
 }
 
 /**
+ * Implements hook_commerce_price_field_formatter_prepare_view().
+ */
+function commerce_discount_commerce_price_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, $items, $displays) {
+  if (
+    $entity_type === 'commerce_order' &&
+    $field['field_name'] === 'commerce_order_total' &&
+    function_exists('commerce_tax_rates') &&
+    commerce_tax_rates() != array()
+  ) {
+    // Wrap the order.
+    $order_wrapper = entity_metadata_wrapper('commerce_order', reset($entities));
+
+    $commerce_order_total = $order_wrapper->commerce_order_total->value();
+
+    // Quit the function if the order total amount equals O.
+    if (empty($commerce_order_total['amount'])) {
+      return;
+    }
+
+    $discount_components = commerce_discount_price_component_load('discount', $commerce_order_total);
+    // Calculating the total discount amount.
+    if (!empty($discount_components)) {
+      $discount_amount = 0;
+      foreach ($discount_components as $component) {
+        $discount_amount += $component['price']['amount'];
+      }
+      $base_price = commerce_price_component_load($commerce_order_total, 'base_price');
+      $base_price = reset($base_price);
+      // Calculating the correct subtotal amount (total order amount - total
+      // discount amount).
+      $subtotal = $base_price['price']['amount'] + $discount_amount;
+      // Next, re-calculate VAT amounts using the found subtotal. (or use existing tax)
+      foreach ($commerce_order_total['data']['components'] as $key => $component) {
+        if (strpos($component['name'], 'tax') === 0 && !empty($component['price']['data']['tax_rate']['rate'])) {
+			    if (!empty($component['price']['amount'])) {
+            $commerce_order_total['data']['components'][$key]['price']['amount'] = $component['price']['amount'];
+          }
+          else {
+            $commerce_order_total['data']['components'][$key]['price']['amount'] = commerce_round(
+              COMMERCE_ROUND_HALF_UP,
+              $subtotal * $component['price']['data']['tax_rate']['rate']
+            );
+          }
+        }
+      }
+
+      // Get the order total amount.
+      $new_total = commerce_price_component_total($commerce_order_total);
+      $commerce_order_total['amount'] = $new_total['amount'];
+
+      // The items var is passed by reference so we are injecting the new field
+      // value into this variable.
+      $items[$order_wrapper->order_id->value()][0] = $commerce_order_total;
+    }
+  }
+}
+
+/**
+ * Load component prices using php strpos function instead of comparison based
+ * on string equality.
+ *
+ * @param string $needle
+ *   The needle to found in the component prices array.
+ * @param array $price
+ *   The component price array.
+ *
+ * @return array
+ *   Return the component prices found.
+ */
+function commerce_discount_price_component_load($needle, $price) {
+  $components = array();
+
+  if (!empty($price['data']['components'])) {
+    foreach ($price['data']['components'] as $component) {
+      if (strpos($component['name'], $needle) === 0) {
+        $components[] = $component;
+      }
+    }
+  }
+
+  return $components;
+}
+
+/**
  * Remove discount components from a given price and recalculate the total.
  *
  * @param $price_wrapper
@@ -282,8 +367,11 @@ function commerce_discount_form_commerce_discount_form_alter(&$form, $form_state
   }
 
   $rule = rules_config_load('commerce_discount_rule_' . $form_state['commerce_discount']->name);
-  if ($rule && $rule->hasStatus(ENTITY_OVERRIDDEN)) {
-    drupal_set_message(t('The rule associated with this discount is overriden, making it impossible to edit the discount.'), 'warning');
+  if (!($rule instanceof RulesReactionRule)) {
+    drupal_set_message(t('Something went wrong during the rule creation, please re-save the discount to fix this issue.'), 'warning');
+  }
+  elseif ($rule->hasStatus(ENTITY_OVERRIDDEN)) {
+    drupal_set_message(t('The rule associated with this discount is overridden, making it impossible to edit the discount.'), 'warning');
     $form['actions']['submit']['#disabled'] = TRUE;
   }
 }
diff --git a/commerce_discount.rules_defaults.inc b/commerce_discount.rules_defaults.inc
index 73df1ec..dab7e2b 100644
--- a/commerce_discount.rules_defaults.inc
+++ b/commerce_discount.rules_defaults.inc
@@ -28,6 +28,7 @@ function commerce_discount_default_rules_configuration() {
       $rule->label = $discount->label;
       $rule->active = $discount->status;
       $rule->tags = array('Commerce Discount', check_plain($type['label']));
+      $rule->weight = -10;
 
       $rule
         ->event(!empty($offer_type['event']) ? $offer_type['event'] : $type['event'])
