Changed $.extend to $.shallowCopy