this.swap = function(a, b) { var x = item[a]; item[a] = item[b]; item[b] = x; item[a].update(a); item[b].update(b); this.empty = a; }