Added undo and redo in rectangleCommand