anchor.diff:      </div>
     <% end %>
     <form id="filter_form" method="get" action="/compare">
  -    <% binary_heading = nil %>
  -    <% Session.features["filter"].each do |f| %>
  +    <% binary_heading = [] %>
  +    <% Session.features["filter"].each_with_index do |f, index| %>
         <div class="feature">
           <% case f.feature_type -%>
  -        <% when "Heading" -%>
  -          <% binary_heading = f %>
  +        <% when "Heading" %>
  +          <% if index > 0 and Session.features["filter"][index-1].feature_type == "Heading" -%>
  +            <% binary_heading << f -%>
  +          <% else # replace any existing binary_heading with a new one -%>
  +            <% binary_heading = [f] -%>
  +          <% end -%>
           <% when "Spacer" -%>
             <div style="height: 17px"><!-- --></div>
           <% when "Categorical" -%>
  
positive.code:             <%ranges = getRanges(f.name)%>
              <%displayed_ranges = displayRanges(f.name, ranges)%>
              <%unless displayed_ranges.map{|dr| 1 if dr[:count]>0}.compact.empty?%>
                <% unless binary_heading.nil? %>
                  <%= render partial: 'filter_label', locals: {f: binary_heading} %>
                  <% binary_heading = nil %>
                  <div style="height: 7px"><!-- --></div>
                <% end %>
                <%= render partial: 'filter_label', locals: {f: f} %>
              <% end %>	
              <% displayed_ranges.each do |dr| %>
  
negative.code:             <%# Bring the chosen products to the top, while preserving the previous ordering (ordered highest count to lowest) %>
              <% optionlist, toplist = cat_order(f, chosen_cats) %>
              <% unless optionlist.empty? %>
                <% binary_heading.each do |bin| %>
                  <%= render partial: 'filter_label', locals: {f: bin} %>
                  <div style="height: 7px"><!-- --></div>
                <% end %>
                <% binary_heading = [] %>
                <%= render partial: 'filter_label', locals: {f: f} %>            
                <% expanded = Session.search.expanded.try{|b| b.include?(f.name)} %>
                <div class="categorical">
  