added ModelState and PieceState to dump the state of a model to be used with the undo manager, written some basic undo manager features