added history and undo option