     # match type any (or)
     if matchType == "any"
       if _.indexOf(conditionMetTracker, true) > 0
-        self.hideShowQuestions(false, ancestorId, $ruleElement, $container)
+        self.hideShowQuestions(false, ancestorId, $ruleElement)
       else
-        self.hideShowQuestions(true, ancestorId, $ruleElement, $container)
+        self.hideShowQuestions(true, ancestorId, $ruleElement)
     # match type all
     if matchType == "all"
       if _.indexOf(conditionMetTracker, false) == -1
-        self.hideShowQuestions(false, ancestorId, $ruleElement, $container)
+        self.hideShowQuestions(false, ancestorId, $ruleElement)
       else
-        self.hideShowQuestions(true, ancestorId, $ruleElement, $container)
+        self.hideShowQuestions(true, ancestorId, $ruleElement)
 
 
   #hide or show questions
-  hideShowQuestions: (hide_questions, ancestor_id, $ruleElement, $container) ->
-    all_questions = $container
-    all_questions << $($container).find(".form-container-repeater[data-question-id=" + ancestor_id + "],[data-question-id=" + ancestor_id + "],[data-ancestor=" + ancestor_id + "]")
+  hideShowQuestions: (hide_questions, ancestor_id, $ruleElement) ->
+    container = $ruleElement.closest('.form-container-survey').find(".form-container-repeater[data-question-id=" + ancestor_id + "],[data-question-id=" + ancestor_id + "],[data-ancestor=" + ancestor_id + "]")
     if hide_questions
-      all_questions.addClass("conditional-logic-hidden")
-      self.clearQuestions(all_questions)
+      container.addClass("conditional-logic-hidden")
+      self.clearQuestions(container)
     else
-      all_questions.removeClass("conditional-logic-hidden")
+      container.removeClass("conditional-logic-hidden")
 
   #clear questions
   clearQuestions: (container) ->

                self.bindConditions(rule.question_id, $(element), condition.operator, condition.answer)
        # hide show questions
        if rule.conditions.length > 1
          self.checkConditionsAndHideShow(rule.conditions, ancestorId, $ruleElement, $container, matchType)
        else
          self.hideShowQuestions(hideQuestions, ancestorId, $ruleElement, $container)
    return

  #bind conditions to question

class ConditionalLogic

  self = ConditionalLogic.prototype

