Made undo button functional