Changed Array.prototype.slice.call() into jQuery's $.each function