Added comments to important sections and fixed animation so that it plays only up to the current state in the view. However, this destroys any redo() history created from undo().