There's a simpler way to make a copy of an array: http://davidwalsh.name/javascript-clone-array