diff --git a/public/sites/all/modules/domaincontext/plugins/domaincontext_context_condition_domain.inc b/public/sites/all/modules/domaincontext/plugins/domaincontext_context_condition_domain.inc
index 4761ed1..f169465 100644
--- a/public/sites/all/modules/domaincontext/plugins/domaincontext_context_condition_domain.inc
+++ b/public/sites/all/modules/domaincontext/plugins/domaincontext_context_condition_domain.inc
@@ -9,30 +9,84 @@
 /**
  * Expose domains as a context condition.
  */
-class domaincontext_context_condition_domain extends context_condition {
-  function condition_values() {
-    $values = array();
-    $format = domain_select_format();
-    foreach (domain_domains() as $data) {
-      ($data['domain_id'] == 0) ? $key = -1 : $key = $data['domain_id'];
-      if ($data['valid'] || user_access('access inactive domains')) {
-        $values[$key] = empty($format) ? check_plain($data['sitename']) : $data['sitename'];
-      }
-    }
-    return $values;
+class domaincontext_context_condition_domain extends context_condition_path {
+  
+  /**
+   * Condition form.
+   */
+  function condition_form($context) {
+    $form = parent::condition_form($context);
+    unset($form['#options']);
+    $form['#description'] = t('Set this context when any of the domains above match the current domain. Put each domain on a separate line. You can use ~ to exclude one or more domains.');
+    $form['#type'] = 'textarea';
+    $form['#default_value'] = implode("\n", $this->fetch_from_context($context, 'values'));
+    return $form;
   }
 
+  /**
+   * Execute.
+   */
   function execute() {
-    $domain = domain_get_domain();
-    $domain_id = $domain['domain_id'];
-    if ($domain_id == 0) {
-      $domain_id = -1;
+  	if ($this->condition_used()) {
+  
+	    $domain = domain_get_domain();
+
+      $domain_subdomain = $domain['subdomain'];
+
+	    $this->values[$domain_subdomain] = array();
+	    $contexts = $this->get_contexts();
+
+	    foreach ($contexts as $context) {
+	      $domain_patterns = $this->fetch_from_context($context, 'values');
+
+	      if ($this->match($domain_subdomain, $domain_patterns)) {
+          $this->values[$domain_subdomain][] = $context->name;
+	        $this->condition_met($context);
+	      }
+	    }
+    }
+  }
+
+  /**
+   * Based on context_condition_path.inc
+   * Simply match a subdomain and negate items with a ~
+   *
+   * @param mixed $subject
+   *   The subject string or an array of strings to be matched.
+   * @param array $patterns
+   *   An array of patterns. Any patterns that begin with ~ are considered
+   *   negative or excluded conditions.
+   */
+  protected function match($subject, $patterns) {
+    //static $regexps;
+    $match = FALSE;
+    $positives = $negatives = 0;
+    $subject = !is_array($subject) ? array($subject) : $subject;
+    foreach ($patterns as $pattern) {
+      if (strpos($pattern, '~') === 0) {
+        $negate = TRUE;
+        $negatives++;
+      }
+      else {
+        $negate = FALSE;
+        $positives++;
+      }
+      $pattern = ltrim($pattern, '~');
+
+      foreach ($subject as $value) {
+        if ($pattern == $value) {
+          if ($negate) {
+            return FALSE;
+          }
+          $match = TRUE;
+        }
+      }
     }
-    $this->values[$domain_id] = array();
-    $contexts = $this->get_contexts($domain_id);
-    foreach ($contexts as $context) {
-      $this->values[$domain_id][] = $context->name;
-      $this->condition_met($context, $domain_id);
+    // If there are **only** negative conditions and we've gotten this far none
+    // we actually have a match.
+    if ($positives === 0 && $negatives) {
+      return TRUE;
     }
+    return $match;
   }
 }