progress on undo.. saving previous state of elements into array.