anchor.diff:        bSortable:false
       }, {
         aTargets:[3],
  -      mData: 'cost',
  +      mData: function(entry) {return entry.card.cost()},
         sClass: 'cost small'
       }, {
         aTargets:[4],
  -      mData: 'cost',
  +      mData: function(entry) { return entry.card.cost() * entry.amount },
         sClass: 'total small',
         bSortable:false
       }],
  -    fnCreatedRow : function(tr, card, iDataIndex) {
  -      $(tr).attr('data-code', card.code)
  +    fnServerData: function(sSource, aoData, fnCallback, oSettings) {
  +      var data = aoDataToMap(aoData)
  +      fnCallback({
  +        sEcho : data.sEcho,
  +        iTotalRecords : deck.codes().length,
  +        aaData : deck.entries(),
  +      })
  +    },
  +    fnCreatedRow : function(tr, entry, iDataIndex) {
  +      updateDeckTr($(tr).attr('data-code', entry.card.code))
       } 
     })
   
  
positive.code:      return '/cards?page=' + (pag.length > 0 ? pag.text() : "1")
    }
  
    var deck = {
      entries : {},
      get : function(code) {
        return this.entries[code]
      },
      add : function(card) {
        var card_entry = this.entries[card.code]
        if(!card_entry) {
          card_entry = this.entries[card.code] = {card : $.extend({}, card), amount : 0}
        } 
        card_entry.amount += 1
        return card_entry
      },
      remove : function(code) {
        delete this.entries[code]
      },
      cost : function() {
        return  _.reduce(this.entries, function(memo, card_entry) {
          return memo + card_entry.amount * card_entry.card.cost()
        }, 0)
      }
    }
   
    var costMap = function() {
      return mageMap[mage()]
    } 
  
    $('#mage_select').one('change', 'input', function() {
  
      var aoDataToMap = function(aoData) {
        return _.reduce(aoData, function(memo, data) {
          memo[data.name] = data.value
          return memo
        }, {})
      }
  
      var extendCard = function(card) {
        return $.extend({
  
negative.code: 
  
    var deckTable = $('#deck_table').dataTable({
      bServerSide: true,
      aoColumnDefs: [{
        aTargets:[0],
        mData: function(entry) {
          return "<button class='btn btn-small'><i class='icon-trash'></i></button><a class='card_href' href='#'>" + entry.card.name + "<a>"
        }
      }, {
        aTargets:[1],
        mData: function(entry) {return entry.card.type_name.substring(0,4)},
        sClass: 'small'
      }, {
        aTargets:[2],
  