function unblockCards(blockedArray){
  if (blockedArray.length >= 1){
    $.each(blockedArray, function(){
      if (this === blockedArray[0]){
        $(this).removeClass("blocked");
      } else if ($(this).find(".suit").text() == $(this).next().find(".suit").text()
        && +$(this).find(".value").text() == +$(this).next().find(".value").text()+1){
        $(this).removeClass("blocked");
      } else {
        console.log("third");
        return false
      }
    });
  }
}


$(document).ready(function(){
  var $columnArray = $(".column")
  
  //flip last row in each column face-up to start game
  $columnArray.each(function(col){
    $(this).children().last().removeClass("faceDown");
  })

  //select card on click
  $(".board .card").on("click", function(){
    var $this = $(this);
    var $selected = $(".selected");

    if(!$this.hasClass("faceDown") && !$this.hasClass("blocked")){
      //for when nothing has been selected
      if($selected.length == 0){
        //select card and cards below
        $this.addClass("selected");
        $this.nextAll().addClass("selected");
      } else {
        var $firstSelected = $($selected[0]);
      // for when cards have been selected
        if($this.hasClass("selected")){
          //remove selected if clicked on selected
          $selected.removeClass("selected");
        } else if (+$this.find(".value").text() == +$firstSelected.find(".value").text()+1){
          var $blockedInCol = $firstSelected.prevAll(".blocked");
          //turn uncovered card face-up
          $selected.prev().removeClass("faceDown");
          //unblock cards
          unblockCards($blockedInCol);
          //move selected card to new column if values allow it
          $selected.appendTo($this.parent());
          $(".card").removeClass("selected");
          //block card when card is off-suit
          if ($this.find(".suit").text() != $firstSelected.find(".suit").text()){
            $firstSelected.prevAll().not(".faceDown").addClass("blocked");
          }
        }
      }
    }
  });

  //handle reserve cards
  $(".reserve .column").on("click", function(){
    var $stack = $(this);
    if(this == $(".reserve .column")[0]){
      $stack.remove();
      $.each($(".board .column"), function(){
        var card = $stack.children().first().detach();
        card.appendTo($(this));
        card.removeClass("faceDown");
      });
    }
  });
});
@@ -513,45 +513,11 @@
 ()%7B%0A
-  var $columnArray = $(%22.column%22)%0A
   %0A
+
   //
@@ -574,19 +574,26 @@
 %0A  $
+(%22.board .
 column
-Array
+%22)
 .eac
@@ -709,19 +709,21 @@
 board .c
-ard
+olumn
 %22).on(%22c
@@ -720,32 +720,41 @@
 mn%22).on(%22click%22,
+ %22.card%22,
  function()%7B%0A   
@@ -742,32 +742,82 @@
 d%22, function()%7B%0A
+    console.log(%22yay! a card has been clicked!%22);%0A
     var $this = 
@@ -2227,31 +2227,8 @@
 %5D)%7B%0A
-      $stack.remove();%0A
     
@@ -2317,17 +2317,8 @@
 st()
-.detach()
 ;%0A  
@@ -2332,62 +2332,85 @@
 ard.
-appendTo($(this));%0A        card.removeClass(%22faceDown%22
+removeClass(%22faceDown%22);%0A        card.remove();%0A        card.appendTo($(this)
 );%0A 

fix click event to make sure cards are selected when clicked when cards are served from reserve stacks