Implemented UndoManager by myself to close #34.