Added limit to undo stack